-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
39 lines (37 loc) · 1.17 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Ansible Galaxy Import
description: Imports the current repo as a role in Ansible Galaxy
inputs:
api-key:
description: Your Ansible Galaxy API key
required: true
github-repository:
description: The owner and repository name. For example gantsign/ansible-role-java.
required: true
default: '${{ github.repository }}'
runs:
using: composite
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install Ansible
shell: sh
run: pip3 install --no-compile ansible-core
env:
FORCE_COLOR: '1'
PY_COLORS: '1'
- name: Trigger a new import on Galaxy
shell: bash
run: |-
REPOSITORY='${{ inputs.github-repository }}'
OWNER_NAME="${REPOSITORY%%/*}"
REPO_NAME="${REPOSITORY#*/}"
[ -z '${{ inputs.api-key }}' ] && >&2 echo "ERROR: api-key is required" && exit 1
echo "Importing role with owner: $OWNER_NAME, repo: $REPO_NAME"
ansible-galaxy role import \
--api-key '${{ inputs.api-key }}' "$OWNER_NAME" "$REPO_NAME"
env:
FORCE_COLOR: '1'
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'