From c2b2070d6d6e8fd0e90e74b5ceda9683e7bae4e2 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Wed, 2 Oct 2024 10:46:39 +0300 Subject: [PATCH] Add API surface validation workflow --- .../validate-generated-api-surface.yml | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/validate-generated-api-surface.yml diff --git a/.github/workflows/validate-generated-api-surface.yml b/.github/workflows/validate-generated-api-surface.yml new file mode 100644 index 00000000000..6bccb7926ce --- /dev/null +++ b/.github/workflows/validate-generated-api-surface.yml @@ -0,0 +1,49 @@ +name: Validate Public API surface changes + +on: + workflow_dispatch: + push: + pull_request: + branches: [ 'main' ] + paths: + - 'src/**/Generated/**' + +permissions: + contents: read + pull-requests: write + issues: write + +jobs: + validate-public-api-surface: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: microsoftgraph/kiota-dom-export-diff-tool/export@main + id: generatePatch + - uses: microsoftgraph/kiota-dom-export-diff-tool/tool@main + if: ${{ steps.generatePatch.outputs.patchFilePath != '' }} + with: + path: ${{ steps.generatePatch.outputs.patchFilePath }} + fail-on-removal: true + id: diff + - uses: microsoftgraph/kiota-dom-export-diff-tool/comment@main + if: ${{ always() && steps.generatePatch.outputs.patchFilePath != '' && steps.diff.outputs.hasExplanations != '' && github.event_name == 'pull_request' }} + continue-on-error: true + with: + comment: ${{ steps.diff.outputs.explanationsFilePath }} + prNumber: ${{ github.event.pull_request.number }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload patch file as artifact + if: always() + uses: actions/upload-artifact@v4 + continue-on-error: true + with: + name: patch + path: '*.patch' + - name: Upload explanations file as artifact + if: always() + uses: actions/upload-artifact@v4 + continue-on-error: true + with: + name: explanations + path: 'explanations.txt'