diff --git a/.github/installer-xml-changes.md b/.github/installer-xml-changes.md new file mode 100644 index 0000000..2b3a569 --- /dev/null +++ b/.github/installer-xml-changes.md @@ -0,0 +1,27 @@ +# Installer XML change reminder + +When an individual installer changes, the shared installer may need an update. + +After `reusable_installer_xml_check.yml` is merged, add +`.github/workflows/installer_xml_check.yml` to each repository that needs the +check: + +```yaml +name: Installer XML changes + +on: + pull_request: + +permissions: + contents: read + +jobs: + check: + uses: aws-deadline/.github/.github/workflows/reusable_installer_xml_check.yml@mainline +``` + +The check fails when XML files under `installer/` or `install_builder/` change. +Review the files listed in the log, check whether the shared installer needs an +update, and confirm any follow-up in the PR discussion. + +Keep private details and links out of public PR discussions. diff --git a/.github/workflows/reusable_installer_xml_check.yml b/.github/workflows/reusable_installer_xml_check.yml new file mode 100644 index 0000000..c80740c --- /dev/null +++ b/.github/workflows/reusable_installer_xml_check.yml @@ -0,0 +1,49 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + +# Call from a standalone Installer XML changes workflow in each repository. +# This advisory check reports installer XML edits for PR review. +name: Installer XML changes + +on: + workflow_call: + +permissions: {} + +jobs: + installer-xml-changes: + name: Installer XML changes + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Checkout PR history + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Check installer XML changes + shell: python + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + import os + import subprocess + + changed_files = subprocess.check_output([ + "git", "-c", "core.quotePath=true", "diff", "--no-ext-diff", "--no-textconv", + "--no-renames", "--name-only", + f"{os.environ['BASE_SHA']}...{os.environ['HEAD_SHA']}", "--", + ":(glob)installer/**/*.[xX][mM][lL]", + ":(glob)install_builder/**/*.[xX][mM][lL]", + ], text=True) + if changed_files: + print(changed_files, end="") + print( + "::error::Installer definitions changed. Please verify whether any related " + "internal changes are needed to reflect the changes in this PR." + ) + raise SystemExit(1)