kovalhome/.github/workflows/infra.yaml

49 lines
1.3 KiB
YAML

name: Infrastructure
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- infra/**
paths:
- infra/**-playbook.yaml
- .github/workflows/infra.yaml
jobs:
check:
name: Check infrastructure definitions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Fetch PR base
if: github.event.pull_request
run: |
git fetch --no-tags --progress --no-recurse-submodules --depth=1 origin ${{ github.event.pull_request.base.sha }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip3 install -r requirements.txt
ansible-galaxy collection install community.general
- name: Get changed playbooks
id: changed-playbooks
run: |
git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD | base64 | xargs -I {} echo "files_b64={}" >> "$GITHUB_OUTPUT"
- name: Check modified playbooks
run: |
export FILES="${{ steps.changed-playbooks.outputs.files_b64 }}"
echo "Got changed files: '$(echo $FILES | base64 -d | xargs echo)'"