generated from amazon-archives/__template_Apache-2.0
-
Couldn't load subscription status.
- Fork 2
misc: auto notify when issue is fixed #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xinsong-cui
wants to merge
9
commits into
main
Choose a base branch
from
auto-notify-issue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+73
−0
Open
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3a4d517
add comment-resolved-issues action
xinsong-cui e733d1f
feedback
xinsong-cui 403c445
feedback
xinsong-cui ded483f
comment
xinsong-cui f608014
fix
xinsong-cui 1e85352
feedback
xinsong-cui 9bc808b
cleanup
xinsong-cui a60f832
feedback
xinsong-cui 1e5c2b7
found issue in changelog, add pr link
xinsong-cui File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: 'Comment on Resolved Issues' | ||
| description: 'Comments on issues referenced in PRs merged since last release' | ||
|
|
||
| inputs: | ||
| token: | ||
| description: > | ||
| Personal access token (PAT) used to fetch the repository. The PAT is configured | ||
| with the local git config, which enables your scripts to run authenticated git | ||
| commands. The post-job step removes the PAT. | ||
| default: ${{ github.token }} | ||
| required: false | ||
xinsong-cui marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Comment on issues | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ inputs.token }} | ||
| run: | | ||
xinsong-cui marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Get the previous tag | ||
| PREVIOUS_TAG=$(git tag --sort=-version:refname | sed -n '2p') | ||
| CURRENT_TAG=$(git tag --sort=-version:refname | sed -n '1p') | ||
|
|
||
| # Convert tag date to GitHub search format | ||
| TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/') | ||
| echo "Using tag date: $TAG_DATE" | ||
|
|
||
| # Find all PRs merged from the last release tag date | ||
| ALL_PRS=$(gh pr list \ | ||
| --state merged \ | ||
| --json number,body,mergedAt \ | ||
| --jq '[.[] | select(.mergedAt > "'$TAG_DATE'") | .number]' | ||
| ) | ||
|
|
||
| # Find all issue number from PRs merged into release branch | ||
| ISSUE_NUMBERS="" | ||
| for pr_number in $(echo "$ALL_PRS" | jq -r '.[]'); do | ||
|
|
||
| # Get the merge commit SHA for this PR | ||
| MERGE_COMMIT=$(gh pr view "$pr_number" --json mergeCommit --jq '.mergeCommit.oid') | ||
|
|
||
| # Check if this commit exists in the release branch | ||
| if git merge-base --is-ancestor "$MERGE_COMMIT" origin/release 2>/dev/null; then | ||
| echo "PR $pr_number is in release branch" | ||
|
|
||
| # Get issue numbers from this PR | ||
| PR_ISSUES=$(gh pr view "$pr_number" --json body --jq '.body' | \ | ||
| grep -o 'issues/[0-9]*' | \ | ||
xinsong-cui marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sed 's/issues\///') | ||
| echo " Found issues: $PR_ISSUES" | ||
|
|
||
| ISSUE_NUMBERS="$ISSUE_NUMBERS $PR_ISSUES" | ||
| fi | ||
| done | ||
|
|
||
| # Comment on each issue found | ||
| echo "$ISSUE_NUMBERS" | tr ' ' '\n' | while read -r issue_number; do | ||
| if [ -n "$issue_number" ]; then | ||
| echo "Commenting on issue #$issue_number" | ||
| if ! gh issue comment "$issue_number" --body "A change related to this issue was included in release: $CURRENT_TAG"; then | ||
| echo "::error::Failed to comment on issue #$issue_number" | ||
| exit 1 | ||
| fi | ||
|
||
| fi | ||
| done | ||
xinsong-cui marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than checking the PR body for GitHub issue links, I was hoping we could be more intentional with these comments by using changelog entries. I think the current implementation will be much noisier than it needs to be