From f86030111295fbf4b5e1279cd60085aa12755d50 Mon Sep 17 00:00:00 2001 From: Ivan Larin Date: Mon, 6 Oct 2025 12:58:29 +0300 Subject: [PATCH 1/2] openapi-diff action --- .github/workflows/changelog.yaml | 44 +++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml index 96b3691..bef65d2 100644 --- a/.github/workflows/changelog.yaml +++ b/.github/workflows/changelog.yaml @@ -28,6 +28,9 @@ on: type: string AWS_CODEARTIFACT_DOMAIN: type: string + diff-tool: + type: string + default: oasdiff jobs: changelog: @@ -134,26 +137,61 @@ jobs: - name: Running OpenAPI Spec diff action id: spec_diff uses: oasdiff/oasdiff-action/changelog@main + if: ${{ inputs.diff-tool == 'oasdiff' }} with: base: base/artefacts/spec.yaml revision: current/artefacts/spec.yaml + - name: Running OpenAPI Diff action + id: spec_diff + uses: Pentusha/openapi-diff-action@v0.0.1 + if: ${{ inputs.diff-tool == 'openapi-diff' }} + with: + old-spec: base/artefacts/spec.yaml + new-spec: current/artefacts/spec.yaml + markdown: openapi-diff.md + - name: Update pull request uses: nefrob/pr-description@v1.1.2 + if: ${{ inputs.diff-tool == 'oasdiff' }} with: content: "\n${{join(steps.spec_diff.outputs.*, '\n')}}\n" token: ${{ secrets.GITHUB_TOKEN }} regex: ".*?" regexFlags: ims + - name: Read openapi-diff.md file + if: ${{ inputs.diff-tool == 'openapi-diff' }} + id: read_diff + run: | + CONTENT=$(cat openapi-diff.md) + echo "diff_content=$CONTENT" >> $GITHUB_OUTPUT + + - name: Update pull request + uses: nefrob/pr-description@v1.1.2 + if: ${{ inputs.diff-tool == 'openapi-diff' }} + with: + content: "\n${{ steps.read_diff.outputs.diff_content }}\n" + token: ${{ secrets.GITHUB_TOKEN }} + regex: ".*?" + regexFlags: ims + + - name: Add label to PR + if: inputs.diff-tool == 'oasdiff' && contains(steps.spec_diff.outputs.changelog, 'error [') + run: | + gh pr edit ${{ github.event.pull_request.number }} --add-label breaking-changes + working-directory: current + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Add label to PR - if: contains(steps.spec_diff.outputs.changelog, 'error [') + if: inputs.diff-tool == 'openapi-diff' && !steps.spec_diff.outputs.state.compatible run: | gh pr edit ${{ github.event.pull_request.number }} --add-label breaking-changes working-directory: current env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Labeler uses: actions/labeler@v5 with: From 0ec181b9b1eda855664723726a4f6d8d444c1618 Mon Sep 17 00:00:00 2001 From: Ivan Larin Date: Mon, 6 Oct 2025 13:04:39 +0300 Subject: [PATCH 2/2] Update .github/workflows/changelog.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/changelog.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml index bef65d2..77405a6 100644 --- a/.github/workflows/changelog.yaml +++ b/.github/workflows/changelog.yaml @@ -164,8 +164,9 @@ jobs: if: ${{ inputs.diff-tool == 'openapi-diff' }} id: read_diff run: | - CONTENT=$(cat openapi-diff.md) - echo "diff_content=$CONTENT" >> $GITHUB_OUTPUT + echo 'diff_content<> $GITHUB_OUTPUT + cat openapi-diff.md >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT - name: Update pull request uses: nefrob/pr-description@v1.1.2