From b2c83dd861739180de5559719e284cabc74b76b0 Mon Sep 17 00:00:00 2001 From: Felix Schnellert Date: Mon, 13 Jul 2026 08:22:36 +0000 Subject: [PATCH] feat: add import-galaxy-role action --- .github/dependabot.yaml | 1 + README.md | 1 + import-ansible-galaxy-role/README.md | 30 +++++++++++++++++++++ import-ansible-galaxy-role/action.yaml | 37 ++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 import-ansible-galaxy-role/README.md create mode 100644 import-ansible-galaxy-role/action.yaml diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 45da94b..71deac0 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -7,6 +7,7 @@ updates: - /build-docker-image - /build-expo-app - /deploy-expo-app + - /import-ansible-galaxy-role - /setup-eas - /setup-java - /setup-turborepo diff --git a/README.md b/README.md index 4554643..5625199 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Please take a closer look at the detailed instructions for the individual action - [build-docker-image](build-docker-image/README.md) - [build-expo-app](build-expo-app/README.md) - [deploy-expo-app](deploy-expo-app/README.md) +- [import-ansible-galaxy-role](import-ansible-galaxy-role/README.md) - [setup-eas](setup-eas/README.md) - [setup-java](setup-java/README.md) - [setup-turborepo](setup-turborepo/README.md) diff --git a/import-ansible-galaxy-role/README.md b/import-ansible-galaxy-role/README.md new file mode 100644 index 0000000..b0cd301 --- /dev/null +++ b/import-ansible-galaxy-role/README.md @@ -0,0 +1,30 @@ +# import-ansible-galaxy-role + +> Import Ansible role to Ansible Galaxy + +This action provides the following functionality for GitHub Actions users: + +* Setup Python +* Install ansible-core +* Import an Ansible role to Ansible Galaxy + +## Usage + +```yaml +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: skriptfabrik/github-actions/import-ansible-galaxy-role@main + with: + api-key: ${{ secrets.GALAXY_API_KEY }} +``` + +## Inputs + +| Name | Required | Default | Description | +| --------------------|----------|----------|--------------------------------------------| +| `api-key` | `true` | `""` | The Ansible Galaxy API key | +| `branch` | `false` | `"main"` | The branch to import | +| `working-directory` | `false` | `"."` | Working directory to run ansible-galaxy in | diff --git a/import-ansible-galaxy-role/action.yaml b/import-ansible-galaxy-role/action.yaml new file mode 100644 index 0000000..9626973 --- /dev/null +++ b/import-ansible-galaxy-role/action.yaml @@ -0,0 +1,37 @@ +name: Ansible Galaxy Role Import +description: Import Ansible role to Ansible Galaxy + +inputs: + api-key: + description: The Ansible Galaxy API key + required: true + + branch: + description: The branch to import + default: main + + working-directory: + description: Working directory to run ansible-galaxy in + default: . + +runs: + using: composite + steps: + - name: Setup Python + uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 + with: + python-version: 3.x + + - name: Install ansible-core + run: python -m pip install --upgrade ansible-core + shell: bash + + - name: Import role to Ansible Galaxy + run: | + ansible-galaxy role import \ + --api-key "${{ inputs.api-key }}" \ + --branch "${{ inputs.branch }}" \ + "${GITHUB_REPOSITORY%%/*}" \ + "${GITHUB_REPOSITORY##*/}" + shell: bash + working-directory: "${{ inputs.working-directory }}"