kovalhome/.github/workflows/infra.yaml

51 lines
1.3 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
2023-08-29 01:11:53 +00:00
fork:
2023-08-28 22:59:57 +00:00
jobs:
check:
name: Check infrastructure definitions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
2023-08-29 01:11:53 +00:00
- run: |
2023-08-29 01:12:29 +00:00
echo !${{ github.event.pull_request.commits }}
echo !${{ github.event.pusher }}
echo !${{ github.event.forkee }}
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-29 01:11:53 +00:00
pip3 install -r requirements.txt ${{ github.event.pull_request.base }}
ansible-galaxy collection install community.general ${{ github.event.pull_request.merge_commit_sha }}
2023-08-28 22:59:57 +00:00
- 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