kovalhome/.github/workflows/infra.yaml

49 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
jobs:
check:
name: Check infrastructure definitions
runs-on: ubuntu-latest
steps:
2023-08-29 01:42:18 +00:00
- name: Checkout
2023-08-29 01:28:49 +00:00
uses: actions/checkout@v3
2023-08-29 01:51:52 +00:00
with:
fetch-depth: 2
2023-08-29 01:36:53 +00:00
2023-08-29 01:47:32 +00:00
- name: Fetch PR base
if: github.event.pull_request
2023-08-29 01:42:18 +00:00
run: |
2023-08-29 01:47:32 +00:00
git fetch --no-tags --progress --no-recurse-submodules --depth=1 origin ${{ github.event.pull_request.base.sha }}
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
2023-08-29 02:10:47 +00:00
run: |
git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD | base64 | xargs -I {} echo "files_b64={}" >> "$GITHUB_OUTPUT"
2023-08-28 22:59:57 +00:00
- name: Check modified playbooks
2023-08-28 23:16:13 +00:00
run: |
2023-08-29 02:10:47 +00:00
export FILES="${{ steps.changed-playbooks.outputs.files_b64 }}"
echo "Got changed files: '$(echo $FILES | base64 -d | xargs echo)'"