-
Notifications
You must be signed in to change notification settings - Fork 17
43 lines (35 loc) · 1.65 KB
/
ansible-lint.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
40
41
42
43
---
name: Yaml and Ansible Lint
on: [push, pull_request, workflow_call] # yamllint disable-line rule:truthy
jobs:
ansible-lint:
runs-on: ubuntu-latest
if: always() && github.repository == 'redhat-cop/infra.convert2rhel'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Ansible
run: pip install --upgrade ansible-core
- name: Build collection
run: ansible-galaxy collection build -vvv
shell: bash
working-directory: ${{ vars.GITHUB_PATH }}
- name: Get version
run: echo "NUM=$(cat galaxy.yml | grep 'version:' | cut -d ':' -f 2 | awk '{print $1}')" >> $GITHUB_OUTPUT
id: vers
- name: Install collection
run: ansible-galaxy collection install ./infra-convert2rhel-${{ steps.vers.outputs.NUM }}.tar.gz
shell: bash
working-directory: ${{ vars.GITHUB_PATH }}
- name: Get dependencies # This sucks lol
run: echo "---" >> ${{ github.run_id }}.yml; echo "collections:" >> ${{ github.run_id }}.yml; cat galaxy.yml | grep -A100 'dependencies:' | cut -d ':' -f 1 | cut -d '"' -f 2 | sed 's/dependencies//' | sed 's/\.\.\.//' | awk NF | sed 's/^/ - name:{{:dumb_space_issue:}}/' >> ${{ github.run_id }}.yml; sed -i 's/{{:dumb_space_issue:}}/ /g' ${{ github.run_id }}.yml; echo "..." >> ${{ github.run_id }}.yml
id: deps
- name: Install collection dependencies
run: ansible-galaxy collection install -r ${{ github.run_id }}.yml
- uses: ansible/ansible-lint@v24
with:
working_directory: .
args: --config=.ansible-lint.yml
...