Skip to content

Commit defc66d

Browse files
committed
test auto notify workflow
1 parent fe9ab2d commit defc66d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/test.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: test.yml
2+
on:
3+
pull_request:
4+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
5+
branches:
6+
- main
7+
- '*-main'
8+
9+
permissions:
10+
issues: write
11+
12+
jobs:
13+
auto_comment:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Get previous release tag
20+
id: get_previous_tag
21+
run: |
22+
PREVIOUS_TAG=$(git describe --tags --abbrev=0)
23+
echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
24+
25+
- name: Comment on PRs with issue numbers
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
PREVIOUS_TAG=$(git describe --tags --abbrev=0)
30+
TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/')
31+
32+
gh pr list \
33+
--search "is:pr is:merged merged:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \
34+
--json number,body \
35+
--jq '.[] | select(.body != null and (.body | test("## Issue #\\s*\\d+"))) | .number' \
36+
| while read issue_number; do
37+
echo "Commenting on issue #$issue_number"
38+
gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release."
39+
done

0 commit comments

Comments
 (0)