Skip to content

Lightspeed 101 Red Hat 1 image changes #43

Lightspeed 101 Red Hat 1 image changes

Lightspeed 101 Red Hat 1 image changes #43

Workflow file for this run

name: lint
on:
# Triggers the workflow on pull request open or reopen on devel and only when an ansible playbook is included
pull_request:
types: [opened, reopened]
branches:
- devel
paths:
- 'images/ansible/*.yml'
# You can also run this workflow manually from the `Actions` tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This `get-ansible-files` job builds an array of ansible playbooks in the `ansible` dir
get-ansible-files:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- id: set-matrix
run: echo "::set-output name=matrix::$(ls images/ansible/*-setup.yml | jq -R -s -c 'split("\n")[:-1]')"
- name: show output
run: echo ${{ steps.set-matrix.outputs.matrix }}
# The `lint` job spins up for each file within the array created above
ansible-lint:
needs: get-ansible-files
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ansible-file: ${{ fromJson(needs.get-ansible-files.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Install python requirements
run: pip install -r requirements.txt
- name: Install collections
run: ansible-playbook images/ansible/workshop-collection-install.yml
- name: Lint Ansible Playbook
# replace "master" with any valid ref
# run: yamllint -d relaxed ${{ matrix.ansible-file }}
env:
GITHUB_ACTIONS: true
run: ansible-lint ${{ matrix.ansible-file }}