From 6c2fe0d5dd3237b43333b831c963b8a6948d7bc0 Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Thu, 15 Dec 2022 09:58:27 +0100 Subject: [PATCH] for #1240: Integrate XEP validation in CI Adds a Github workflow that executes `tools/validate-xep0001-conformance.sh` against any changed XEP that was changed in a pull request, leaving a comment that describes the validation result. --- .github/workflows/xep-validation.yml | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/xep-validation.yml diff --git a/.github/workflows/xep-validation.yml b/.github/workflows/xep-validation.yml new file mode 100644 index 000000000..5facd7712 --- /dev/null +++ b/.github/workflows/xep-validation.yml @@ -0,0 +1,45 @@ +name: XEP validation + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + name: Test changed-files + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Detect changes to XEP files. + id: changed-xeps + uses: tj-actions/changed-files@v34 + with: + files: | + xep-*.xml + inbox/* + + - name: Run step if any file(s) in the docs folder change. + id: validation + if: steps.changed-xeps.outputs.any_changed == 'true' + run: | + result=Success + for xep in "${{ steps.changed-xeps.outputs.all_changed_files }}"; do + if ! tools/validate-xep0001-conformance.sh "$xep"; then + result=Failure + echo "validate_$xep=success" >> $GITHUB_OUTPUT + else + echo "validate_$xep=failure" >> $GITHUB_OUTPUT + fi + done + echo "result=$result" >> $GITHUB_OUTPUT + + - uses: mshick/add-pr-comment@v2 + if: steps.changed-files-specific.outputs.any_changed == 'true' + with: + issue: ${{ steps.validation.outputs.result }} + message: | + Automated XEP validation result: ${{ steps.validation.outputs.result }}