Skip to content

Commit

Permalink
CI: Post output from semver-checks as a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorak-mmk committed Jan 28, 2024
1 parent 3fc823b commit 0502fa1
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/semver_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
timeout-minutes: 30
outputs:
exitcode: ${{ steps.semver-pr-check.outputs.exitcode }}
output: ${{ steps.semver-pr-check.outputs.output }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -56,8 +57,11 @@ jobs:
id: semver-pr-check
run: |
set +e
make semver-rev rev="$PR_BASE"
exitcode=$?
echo "output<<SEMVER_STDOUT_EOF" >> $GITHUB_OUTPUT
# Weird sed strip ANSI colors from output
make semver-rev rev="$PR_BASE" |& tee /dev/tty | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" >> $GITHUB_OUTPUT
exitcode=${PIPESTATUS[0]}
echo "SEMVER_STDOUT_EOF" >> $GITHUB_OUTPUT
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
exit "$exitcode"
continue-on-error: true
Expand All @@ -82,6 +86,26 @@ jobs:
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>
\`\`\`
$SEMVER_OUTPUT
\`\`\`
</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 }}


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

0 comments on commit 0502fa1

Please sign in to comment.