FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add feature for towncrier-run.yml to comment on PR when it fails. by Ciemaar · Pull Request #361 · beeware/.github · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .yml  (1) All 1 file type selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
22 changes: 22 additions & 0 deletions .github/workflows/towncrier-run.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ on:
default: "ubuntu-latest"
type: string

permissions:
pull-requests: write

defaults:
run:
shell: bash
Expand Down Expand Up @@ -71,6 +74,25 @@ jobs:
id: tox
run: tox -e towncrier-check

- name: Add PR comment if change note is missing
if: always() && github.event_name == 'pull_request' && steps.tox.outcome == 'failure'
env:
GITHUB_TOKEN: ${{ github.token }}
PR_NUM: ${{ github.event.pull_request.number }}
run: |
MESSAGE="Thank you for your pull request! Unfortunately, CI checks for this pull request are failing because you haven't included a change note in your contribution. Details on creating a change note can be found in the [BeeWare Contribution Guide](https://beeware.org/contributing/guide/how/change-note/).

<!-- towncrier-missing-change-note -->"

COMMENTS=$(gh api repos/${{ github.repository }}/issues/${PR_NUM}/comments)
HAS_COMMENT=$(jq -r '.[] | select(.body | contains("<!-- towncrier-missing-change-note -->")) | .body' <<< "$COMMENTS")

if [ -z "$HAS_COMMENT" ]; then
gh api --method POST repos/${{ github.repository }}/issues/${PR_NUM}/comments -f body="$MESSAGE"
else
echo "Comment already exists."
fi

- name: Towncrier Check Resolution Instructions
if: always() && steps.tox.outcome == 'failure'
run: |
Expand Down
Loading

Back | FazBrowse Home | New Git URL