File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ name : ' Comment on Resolved Issues'
2+ description : ' Comments on issues referenced in PRs merged since last release'
3+
4+ inputs :
5+ token :
6+ description : >
7+ Personal access token (PAT) used to fetch the repository. The PAT is configured
8+ with the local git config, which enables your scripts to run authenticated git
9+ commands. The post-job step removes the PAT.
10+ default : ${{ github.token }}
11+ required : false
12+
13+ runs :
14+ using : composite
15+ steps :
16+ - name : Comment on issues
17+ shell : bash
18+ env :
19+ GH_TOKEN : ${{ inputs.token }}
20+ run : |
21+ # Get the previous tag
22+ PREVIOUS_TAG=$(git tag --sort=-version:refname | sed -n '2p')
23+
24+ # Convert tag date to GitHub search format
25+ TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/')
26+ echo "Using tag date : $TAG_DATE"
27+
28+ # Find issue numbers from PRs created from the last release tag date
29+ ISSUE_NUMBERS=$(gh pr list \
30+ --json number,body,createdAt \
31+ --jq '.[] | select(.createdAt > "'$TAG_DATE'") | .body' | \
32+ grep -o 'issues/[0-9]*' | \
33+ sed 's/issues\///'
34+ )
35+
36+ # Comment on each issue found
37+ for issue_number in $ISSUE_NUMBERS; do
38+ echo "Commenting on issue # $issue_number"
39+ gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." || echo "Failed to comment on # $issue_number"
40+ done
You can’t perform that action at this time.
0 commit comments