kovalhome/.github/workflows/infra.yaml

47 lines
1.1 KiB
YAML
Raw Normal View History

2023-08-28 22:59:57 +00:00
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
2023-08-29 00:56:06 +00:00
with:
fetch-depth: 2
2023-08-28 22:59:57 +00:00
- name: Setup Python
uses: actions/setup-python@v4
with:
2023-08-28 23:45:24 +00:00
python-version: "3.11"
2023-08-28 22:59:57 +00:00
- name: Install dependencies
2023-08-28 23:16:13 +00:00
run: |
2023-08-28 22:59:57 +00:00
pip3 install -r requirements.txt
ansible-galaxy collection install community.general
- name: Get changed playbooks
id: changed-playbooks
uses: tj-actions/changed-files@v38
with:
2023-08-29 00:44:10 +00:00
since_last_remote_commit: "true"
2023-08-28 22:59:57 +00:00
files: infra/**-playbook.yaml
- name: Check modified playbooks
2023-08-28 23:16:13 +00:00
run: |
2023-08-28 22:59:57 +00:00
for file in ${{ steps.changed-playbooks.outputs.all_changed_files }}; do
ansible --inventory ./inventory --check "$file"
done