Skip to content

Commit

Permalink
Merge pull request scylladb#952 from scylladb/semver-checks-edit-comment
Browse files Browse the repository at this point in the history
semver_checks: Edit comment instead of posting new one
  • Loading branch information
Lorak-mmk authored Mar 12, 2024
2 parents 7648b1b + a875d12 commit 07df198
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions .github/workflows/semver_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,38 +86,55 @@ jobs:
needs: semver-pull-request-check
timeout-minutes: 3
steps:
- name: Get ID of comment if posted previously.
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ env.PR_ID }}
comment-author: 'github-actions[bot]'
body-includes: semver
- name: Remove breaking label on success
run: gh pr edit "$PR_ID" --remove-label semver-checks-breaking
if: needs.semver-pull-request-check.outputs.exitcode == '0'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
- name: Report that there were no breaks
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ env.PR_ID }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
body: |
`cargo semver-checks` found no API-breaking changes in this PR! 🎉🥳
Checked commit: ${{ env.PR_HEAD }}
edit-mode: replace
if: needs.semver-pull-request-check.outputs.exitcode == '0'
- name: Add breaking label on failure
run: gh pr edit "$PR_ID" --add-label semver-checks-breaking
if: needs.semver-pull-request-check.outputs.exitcode != '0'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
- name: Post report on semver break
run: |
gh pr comment "$PR_ID" --body "\
\`cargo semver-checks\` detected some API incompatibilities in this PR.
See the following report for details:
<details>
<summary>cargo semver-checks output</summary>
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ env.PR_ID }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
body: |
`cargo semver-checks` detected some API incompatibilities in this PR.
Checked commit: ${{ env.PR_HEAD }}
\`\`\`
$SEMVER_OUTPUT
\`\`\`
See the following report for details:
<details>
<summary>cargo semver-checks output</summary>
</details>
"
if: needs.semver-pull-request-check.outputs.exitcode != '0'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
SEMVER_OUTPUT: ${{ needs.semver-pull-request-check.outputs.output }}
```
${{ needs.semver-pull-request-check.outputs.output }}
```
</details>
edit-mode: replace
if: needs.semver-pull-request-check.outputs.exitcode != '0'

semver-push-tag:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 07df198

Please sign in to comment.