name: Infrastructure on: pull_request: branches: - main push: branches: - main tags: - infra/** paths: - infra/**-playbook.yaml - .github/workflows/infra.yaml fork: jobs: check: name: Check infrastructure definitions runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - 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: Test if: github.event.forkee run: echo dot! - run: | echo !${{ github.event.pull_request.base.repo }} !${{ github.event.pull_request.base.sha }} echo !${{ github.event.pusher }} echo !${{ github.event.forkee }} git remote get-url origin git branch -l | cat - 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 uses: tj-actions/changed-files@v38 with: base_sha: ${{ github.event.pull_request.base.sha }} files: infra/**-playbook.yaml - name: Check modified playbooks run: | for file in ${{ steps.changed-playbooks.outputs.all_changed_files }}; do ansible --inventory ./inventory --check "$file" done