diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-10-12 05:39:53 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-11 20:39:53 +0200 |
commit | d763b99107a0a9da4f0a9e59ebe51d4a2704bc0e (patch) | |
tree | 55b90b2538e68d8506d39fdeab4718d2f2086020 /.github/workflows | |
parent | d503510e9afd77f55c1c8d76aae298393de1c846 (diff) | |
download | skyhanni-d763b99107a0a9da4f0a9e59ebe51d4a2704bc0e.tar.gz skyhanni-d763b99107a0a9da4f0a9e59ebe51d4a2704bc0e.tar.bz2 skyhanni-d763b99107a0a9da4f0a9e59ebe51d4a2704bc0e.zip |
Backend: Add Changelog Verification (#2692)
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/pr-check.yml | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 000000000..cabb09c1d --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,57 @@ +name: "PR Changelog Verification" + +on: + pull_request_target: + types: [ opened, edited ] + +jobs: + verify-changelog: + if: github.event.pull_request.state == 'open' && '511310721' == github.repository_id + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: ./.github/actions/setup-normal-workspace + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run ChangeLog verification + env: + PR_TITLE: ${{ github.event.pull_request.title }} + PR_BODY: ${{ github.event.pull_request.body }} + run: | + ./gradlew checkPrDescription -PprTitle="${PR_TITLE}" -PprBody="${PR_BODY}" + + - name: Add label if changelog verification fails + if: failure() + uses: actions-ecosystem/action-add-labels@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: 'Wrong Title/Changelog' + + - name: Remove label if changelog verification passes + if: success() + uses: actions-ecosystem/action-remove-labels@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + labels: 'Wrong Title/Changelog' + + - name: Add comment to PR if changelog verification fails + if: failure() + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const test = fs.readFileSync('build/changelog_errors.txt', 'utf8'); + const commentBody = `${test}` + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }) |