From 8cd84fd91a4e963e6ab7c0cebc074d5a711d9899 Mon Sep 17 00:00:00 2001 From: Alex Kanitz Date: Tue, 29 Oct 2024 23:08:58 +0100 Subject: [PATCH] Create diff_comment.yml --- .github/workflows/diff_comment.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/diff_comment.yml diff --git a/.github/workflows/diff_comment.yml b/.github/workflows/diff_comment.yml new file mode 100644 index 0000000..2c088bf --- /dev/null +++ b/.github/workflows/diff_comment.yml @@ -0,0 +1,29 @@ +name: OpenAPI diff comment + +on: + workflow_run: + workflows: ["Lint and validate OpenAPI specs"] + types: [completed] + +jobs: + comment: + runs-on: ubuntu-latest + if: github.event.workflow_run.outputs.diff_generated == 'openapi-diff-log' + permissions: + issues: write + steps: + - name: Download diff + uses: actions/download-artifact@v4 + with: + name: openapi-diff-log + - name: Create PR comment + uses: actions/github-script@v7 + with: + script: | + const diff = require('fs').readFileSync('diff.md', 'utf8'); + github.rest.issues.createComment({ + issue_number: github.event.workflow_run.pull_requests[0].number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '## OpenAPI diff:\n\n' + diff + })