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:
|
2023-08-29 01:28:49 +00:00
|
|
|
- name: Checkout target
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.base.ref }}
|
2023-08-28 22:59:57 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
2023-08-29 01:11:53 +00:00
|
|
|
|
|
|
|
- run: |
|
2023-08-29 01:14:45 +00:00
|
|
|
echo !${{ github.event.pull_request.base.repo }} !${{ github.event.pull_request.base.sha }}
|
2023-08-29 01:12:29 +00:00
|
|
|
echo !${{ github.event.pusher }}
|
|
|
|
echo !${{ github.event.forkee }}
|
2023-08-29 01:24:41 +00:00
|
|
|
git remote get-url origin
|
2023-08-29 01:25:57 +00:00
|
|
|
git branch -l | cat
|
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:13:40 +00:00
|
|
|
pip3 install -r requirements.txt
|
|
|
|
ansible-galaxy collection install community.general
|
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
|