robertdebock / galaxy-action

Publish Ansible roles to Galaxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ansible-galaxy role import: error: the following arguments are required: github_repo

juju4 opened this issue · comments

Tried different combinations with or without path to use galaxy action but not working.
I fear that I'm missing something obvious but can you help give me directions to make it work?

https://github.com/juju4/ansible-adduser/actions/workflows/galaxy.yml

my current workflow

---
name: Ansible Galaxy release

on:
  release:
    types: [created, edited, published, released]
  push:
    tags:
      - '*'
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: checkout
        uses: actions/checkout@v2
        with:
          path: juju4.adduser
  release:
    runs-on: ubuntu-latest
    needs:
      - build
    steps:
      - name: galaxy
        uses: robertdebock/galaxy-action@1.1.1
        with:
          galaxy_api_key: ${{ secrets.galaxy_api_key }}
          path: juju4.adduser

but still getting above error which seems to indicate a missing variable but outside of galaxy_api_key and path, I see nothing.

Hi,

You may mention path, when your code is not in the current directory (./). In my case; the Ansible role is in the current directory (./), so I can just not mention the path.

Here is my use-case: https://github.com/robertdebock/ansible-role-users/blob/master/.github/workflows/galaxy.yml

Regards,

Robert.

That was my initial attempt but failing.
https://github.com/juju4/ansible-adduser/blob/7c583ed0379f2b0ff6bb8a5ee94662edd7a68796/.github/workflows/galaxy.yml

---
name: Ansible Galaxy release

on:
  release:
    types: [created, edited, published, released]
  push:
    tags:
      - '*'
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: galaxy
        uses: robertdebock/galaxy-action@1.1.0
        with:
          galaxy_api_key: ${{ secrets.galaxy_api_key }}

Result
https://github.com/juju4/ansible-adduser/runs/4127321048?check_suite_focus=true#step:3:1

/usr/bin/docker run --name robertdebockgithubactiongalaxy_b2eeb7 --label e28490 --workdir /github/workspace --rm -e INPUT_GALAXY_API_KEY -e INPUT_PATH -e galaxy_api_key -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/ansible-adduser/ansible-adduser":"/github/workspace" robertdebock/github-action-galaxy
usage: ansible-galaxy role import [-h] [-s API_SERVER] [--token API_KEY] [-c]
                                  [-v] [--no-wait] [--branch REFERENCE]
                                  [--role-name ROLE_NAME] [--status]
                                  github_user github_repo
ansible-galaxy role import: error: the following arguments are required: github_repo
 
usage: ansible-galaxy [-h] [--version] [-v] TYPE ...

Perform various Role and Collection related operations.

positional arguments:
  TYPE
    collection   Manage an Ansible Galaxy collection.
    role         Manage an Ansible Galaxy role.

optional arguments:
  --version      show program's version number, config file location,
                 configured module search path, module location, executable
                 location and exit
  -h, --help     show this help message and exit
  -v, --verbose  verbose mode (-vvv for more, -vvvv to enable connection
                 debugging)

I had the same problem. I had forgotten to insert the galaxy_api_key as a repository secret.

@robertdebock, maybe you could add this as a known error in the readme, or check that galaxy_api_key is defined?

I've described it a bit more explicit in the README.md. Let me know if you have a better description.

In my case, galaxy_api_key is defined (but variable name converted upper case by GITHUB)

I was struggling with the exact same issue and now found the culprit in how I entered the API key in GitHub:
You must define it as Repository secret, not as Environment secret.

That's it. working now. Good call! Thanks a lot!

For information, if others get this error appearing again, ensure to update galaxy-action to 1.2.1.
I got error with 1.1.1