From defc66dba99d1147f3273cb0ddfbfab73afb923e Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 13:35:22 -0400 Subject: [PATCH 01/21] test auto notify workflow --- .github/workflows/test.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000000..d36b29cc6f3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: test.yml +on: + pull_request: + types: [ opened, synchronize, reopened, labeled, unlabeled ] + branches: + - main + - '*-main' + +permissions: + issues: write + +jobs: + auto_comment: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Get previous release tag + id: get_previous_tag + run: | + PREVIOUS_TAG=$(git describe --tags --abbrev=0) + echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT + + - name: Comment on PRs with issue numbers + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + PREVIOUS_TAG=$(git describe --tags --abbrev=0) + TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/') + + gh pr list \ + --search "is:pr is:merged merged:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ + --json number,body \ + --jq '.[] | select(.body != null and (.body | test("## Issue #\\s*\\d+"))) | .number' \ + | while read issue_number; do + echo "Commenting on issue #$issue_number" + gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." + done \ No newline at end of file From 1b31f86a11ec7add445d536adb41ea910ac380c4 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 13:41:20 -0400 Subject: [PATCH 02/21] echo tag date --- .github/workflows/test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d36b29cc6f3..888f2c03c5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,11 +16,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Get previous release tag - id: get_previous_tag - run: | - PREVIOUS_TAG=$(git describe --tags --abbrev=0) - echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT - name: Comment on PRs with issue numbers env: @@ -28,7 +23,7 @@ jobs: run: | PREVIOUS_TAG=$(git describe --tags --abbrev=0) TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/') - + echo "$TAG_DATE" gh pr list \ --search "is:pr is:merged merged:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ --json number,body \ From 2ae26daca4ff14c7a6e93a211360023716c72647 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 13:42:59 -0400 Subject: [PATCH 03/21] echo found prs --- .github/workflows/test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 888f2c03c5b..356a926a373 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,14 @@ jobs: PREVIOUS_TAG=$(git describe --tags --abbrev=0) TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/') echo "$TAG_DATE" + + PR_DATA=$(gh pr list \ + --search "is:pr is:merged merged:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ + --json number,body \ + --jq '.[] | select(.body != null and (.body | test("## Issue #\\s*\\d+"))) | .number' \ + ) + echo "Found PRs:" + echo "$PR_DATA" gh pr list \ --search "is:pr is:merged merged:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ --json number,body \ From 439ef9fb48bd3d18e6809629c901ce55bb1ec0f0 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 14:08:23 -0400 Subject: [PATCH 04/21] correctly find issue number --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 356a926a373..2c148b334a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,16 +26,16 @@ jobs: echo "$TAG_DATE" PR_DATA=$(gh pr list \ - --search "is:pr is:merged merged:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ + --search "is:pr is:open created:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ --json number,body \ - --jq '.[] | select(.body != null and (.body | test("## Issue #\\s*\\d+"))) | .number' \ + --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' ) echo "Found PRs:" echo "$PR_DATA" gh pr list \ - --search "is:pr is:merged merged:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ + --search "is:pr is:open created:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ --json number,body \ - --jq '.[] | select(.body != null and (.body | test("## Issue #\\s*\\d+"))) | .number' \ + --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' | while read issue_number; do echo "Commenting on issue #$issue_number" gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." From ac3c0c34684968c1d849830e4a96d4bca69887ca Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 14:11:34 -0400 Subject: [PATCH 05/21] syntax --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c148b334a6..19c8b30dd6f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,16 +26,16 @@ jobs: echo "$TAG_DATE" PR_DATA=$(gh pr list \ - --search "is:pr is:open created:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ + --search "is:pr is:open created:>=$TAG_DATE \ --json number,body \ --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' ) echo "Found PRs:" echo "$PR_DATA" gh pr list \ - --search "is:pr is:open created:>=$TAG_DATE OR is:open created:>=$TAG_DATE" \ + --search "is:pr is:open created:>=$TAG_DATE \ --json number,body \ - --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' + --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' \ | while read issue_number; do echo "Commenting on issue #$issue_number" gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." From a3a1c771148ce25b321880a8624e17f9a4c88762 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 14:13:37 -0400 Subject: [PATCH 06/21] syntax --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 19c8b30dd6f..f707ed9c203 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,14 +26,14 @@ jobs: echo "$TAG_DATE" PR_DATA=$(gh pr list \ - --search "is:pr is:open created:>=$TAG_DATE \ + --search "is:pr is:open created:>=$TAG_DATE" \ --json number,body \ --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' ) echo "Found PRs:" echo "$PR_DATA" gh pr list \ - --search "is:pr is:open created:>=$TAG_DATE \ + --search "is:pr is:open created:>=$TAG_DATE" \ --json number,body \ --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' \ | while read issue_number; do From d2e8ea5aeef6eaf4f5d8eb81959f291fea2de95f Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 14:18:15 -0400 Subject: [PATCH 07/21] syntax --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f707ed9c203..da97668def7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: gh pr list \ --search "is:pr is:open created:>=$TAG_DATE" \ --json number,body \ - --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' \ + --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' | while read issue_number; do echo "Commenting on issue #$issue_number" gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." From 7bb738b53c06d3cd1f71809796febb86372d8918 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 14:28:16 -0400 Subject: [PATCH 08/21] refactor --- .github/workflows/test.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da97668def7..09f69ae7d78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,20 +23,17 @@ jobs: run: | PREVIOUS_TAG=$(git describe --tags --abbrev=0) TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/') - echo "$TAG_DATE" + echo "Using tag date: $TAG_DATE" - PR_DATA=$(gh pr list \ - --search "is:pr is:open created:>=$TAG_DATE" \ - --json number,body \ - --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' - ) - echo "Found PRs:" - echo "$PR_DATA" - gh pr list \ - --search "is:pr is:open created:>=$TAG_DATE" \ - --json number,body \ - --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' - | while read issue_number; do + ISSUE_NUMBERS=$(gh pr list --search "is:pr is:open created:>=$TAG_DATE" --json number,body --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' | sort -u) + + if [ -z "$ISSUE_NUMBERS" ]; then + echo "No issues found in recent PRs" + exit 0 + fi + + echo "Found issues: $ISSUE_NUMBERS" + for issue_number in $ISSUE_NUMBERS; do echo "Commenting on issue #$issue_number" gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." done \ No newline at end of file From dd6944f308ca2bf50d7a4e292d8327568954ed38 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Wed, 15 Oct 2025 17:09:28 -0400 Subject: [PATCH 09/21] stop using gh search --- .github/workflows/test.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09f69ae7d78..4649797764b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,15 +25,16 @@ jobs: TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/') echo "Using tag date: $TAG_DATE" - ISSUE_NUMBERS=$(gh pr list --search "is:pr is:open created:>=$TAG_DATE" --json number,body --jq '.[] | select(.body != null and (.body | test("issues/\\d+"))) | [.body | scan("issues/(\\d+)"; "g")] | .[]' | sort -u) - - if [ -z "$ISSUE_NUMBERS" ]; then - echo "No issues found in recent PRs" - exit 0 - fi + ISSUE_NUMBERS=$(gh pr list \ + --json number,body,createdAt \ + --jq $'.[] | select(.createdAt > "'$TAG_DATE'") | .body' | \ + grep -o 'issues/[0-9]*' | \ + sed 's/issues\///' + ) echo "Found issues: $ISSUE_NUMBERS" - for issue_number in $ISSUE_NUMBERS; do + + for issue_number in $ISSUE_NUMBERS; do echo "Commenting on issue #$issue_number" gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." done \ No newline at end of file From e5ebae1fa8db0e53064e9486a0e3a6b489553582 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 13:58:04 -0400 Subject: [PATCH 10/21] update test --- .github/workflows/test.yml | 67 ++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4649797764b..951f81af561 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,21 +20,54 @@ jobs: - name: Comment on PRs with issue numbers env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - PREVIOUS_TAG=$(git describe --tags --abbrev=0) - TAG_DATE=$(git log -1 --format="%ci" "$PREVIOUS_TAG" | sed 's/ /T/' | sed 's/ +0000/Z/') - echo "Using tag date: $TAG_DATE" - - ISSUE_NUMBERS=$(gh pr list \ - --json number,body,createdAt \ - --jq $'.[] | select(.createdAt > "'$TAG_DATE'") | .body' | \ - grep -o 'issues/[0-9]*' | \ - sed 's/issues\///' - ) - - echo "Found issues: $ISSUE_NUMBERS" - - for issue_number in $ISSUE_NUMBERS; do +runs: + using: composite + steps: + - name: Comment on issues + shell: bash + env: + GH_TOKEN: ${{ inputs.token }} + run: | + # 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 open \ + --json number,body,createdAt \ + --jq '[.[] | select(.createdAt > "$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]*' | \ + 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" - gh issue comment "$issue_number" --body "This issue was resolved and included in the latest release." - done \ No newline at end of file + gh issue comment "$issue_number" --body "A change related to this issue was included in release: $CURRENT_TAG" || echo "::error Failed to comment on #$issue_number" + fi + done \ No newline at end of file From 0ff188621b97b9c0a0b689aefd918a261808c31b Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 14:03:04 -0400 Subject: [PATCH 11/21] fix --- .github/workflows/test.yml | 95 ++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 951f81af561..375e2f2681e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,54 +20,47 @@ jobs: - name: Comment on PRs with issue numbers env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} -runs: - using: composite - steps: - - name: Comment on issues - shell: bash - env: - GH_TOKEN: ${{ inputs.token }} - run: | - # 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 open \ - --json number,body,createdAt \ - --jq '[.[] | select(.createdAt > "$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]*' | \ - 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" - gh issue comment "$issue_number" --body "A change related to this issue was included in release: $CURRENT_TAG" || echo "::error Failed to comment on #$issue_number" - fi - done \ No newline at end of file + run: | + # 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 open \ + --json number,body,createdAt \ + --jq '[.[] | select(.createdAt > "$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]*' | \ + 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" + gh issue comment "$issue_number" --body "A change related to this issue was included in release: $CURRENT_TAG" || echo "::error Failed to comment on #$issue_number" + fi + done \ No newline at end of file From 46994360af9a0944522f70942f4d4dd1465390fb Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 14:04:40 -0400 Subject: [PATCH 12/21] update tag date --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 375e2f2681e..60b696d5541 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Get the previous tag - PREVIOUS_TAG=$(git tag --sort=-version:refname | sed -n '2p') + PREVIOUS_TAG=$(git tag --sort=-version:refname | sed -n '5p') CURRENT_TAG=$(git tag --sort=-version:refname | sed -n '1p') # Convert tag date to GitHub search format From 01ee59a0010f8941d15013ab13072c564ed3ff83 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 14:06:40 -0400 Subject: [PATCH 13/21] add echo for debug --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60b696d5541..c8f7ccecb8a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,6 +35,7 @@ jobs: --json number,body,createdAt \ --jq '[.[] | select(.createdAt > "$TAG_DATE") | .number]' ) + echo "Found PRs: $ALL_PRS" # Find all issue number from PRs merged into release branch ISSUE_NUMBERS="" @@ -42,6 +43,7 @@ jobs: # Get the merge commit SHA for this PR MERGE_COMMIT=$(gh pr view "$pr_number" --json mergeCommit --jq '.mergeCommit.oid') + echo " PR $pr_number merge commit: $MERGE_COMMIT" # Check if this commit exists in the release branch if git merge-base --is-ancestor "$MERGE_COMMIT" origin/release 2>/dev/null; then From 98b51ac61a7a65a2c7564a01bdd71830773b3d05 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 14:09:52 -0400 Subject: [PATCH 14/21] add testing block --- .github/workflows/test.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8f7ccecb8a..0bedbc1d729 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -57,8 +57,19 @@ jobs: ISSUE_NUMBERS="$ISSUE_NUMBERS $PR_ISSUES" fi + + # TESTING + # testing fetching issue number + PR_ISSUES=$(gh pr view "$pr_number" --json body --jq '.body' | \ + grep -o 'issues/[0-9]*' | \ + sed 's/issues\///') + echo " Found issues: $PR_ISSUES" + ISSUE_NUMBERS="$ISSUE_NUMBERS $PR_ISSUES" + done + + # Comment on each issue found echo "$ISSUE_NUMBERS" | tr ' ' '\n' | while read -r issue_number; do if [ -n "$issue_number" ]; then From 6f1c34bf4eae292242692f51b4732575f1ff6781 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 14:17:51 -0400 Subject: [PATCH 15/21] fix --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0bedbc1d729..5decb181835 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: ALL_PRS=$(gh pr list \ --state open \ --json number,body,createdAt \ - --jq '[.[] | select(.createdAt > "$TAG_DATE") | .number]' + --jq '[.[] | select(.createdAt > "'$TAG_DATE'") | .number]' ) echo "Found PRs: $ALL_PRS" From 56c4be3326228291d8855c1ee8fdcd76d76f3d14 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 14:41:22 -0400 Subject: [PATCH 16/21] test fail step --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5decb181835..1c4d3ebce5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -74,6 +74,9 @@ jobs: echo "$ISSUE_NUMBERS" | tr ' ' '\n' | while read -r issue_number; do if [ -n "$issue_number" ]; then echo "Commenting on issue #$issue_number" - gh issue comment "$issue_number" --body "A change related to this issue was included in release: $CURRENT_TAG" || echo "::error Failed to comment on #$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 \ No newline at end of file From e776e58d2f5f5dda04baf2d78537512335aa41be Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 16:53:39 -0400 Subject: [PATCH 17/21] test new change --- .github/workflows/test.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1c4d3ebce5b..9a9ed1daf03 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,12 +71,19 @@ jobs: # Comment on each issue found + FAILURES="" + 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 + if ! gh issue comment "$issue_number" --body "A change related to this issue was included in [release **$CURRENT_TAG**](https://github.com/${{ github.repository }}/releases/tag/$CURRENT_TAG)."; then echo "::error::Failed to comment on issue #$issue_number" - exit 1 + FAILURES="$FAILURES #$issuenumber" fi fi - done \ No newline at end of file + done + + if [ -n "$FAILURES" ]; then + echo "::error::Failed to update the following issue(s):$FAILURES" + exit 1 + fi \ No newline at end of file From e8a2d399de1417a642633556527afd6e52b98fe9 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 17:09:32 -0400 Subject: [PATCH 18/21] test new change --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a9ed1daf03..5f45d1e408a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,7 +73,7 @@ jobs: # Comment on each issue found FAILURES="" - echo "$ISSUE_NUMBERS" | tr ' ' '\n' | while read -r issue_number; do + 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**](https://github.com/${{ github.repository }}/releases/tag/$CURRENT_TAG)."; then @@ -81,7 +81,7 @@ jobs: FAILURES="$FAILURES #$issuenumber" fi fi - done + done < <(echo "$ISSUE_NUMBERS" | tr ' ' '\n') if [ -n "$FAILURES" ]; then echo "::error::Failed to update the following issue(s):$FAILURES" From 599c0a8e5bfc20436be0e98ef2beda28cb8bebfc Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Fri, 17 Oct 2025 17:11:48 -0400 Subject: [PATCH 19/21] typo --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f45d1e408a..b17c2e3a66c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,7 +78,7 @@ jobs: 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**](https://github.com/${{ github.repository }}/releases/tag/$CURRENT_TAG)."; then echo "::error::Failed to comment on issue #$issue_number" - FAILURES="$FAILURES #$issuenumber" + FAILURES="$FAILURES #$issue_number" fi fi done < <(echo "$ISSUE_NUMBERS" | tr ' ' '\n') From cceeb0bb867d45c00e76ed211c0a98d53334471a Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Mon, 20 Oct 2025 16:37:45 -0400 Subject: [PATCH 20/21] read from changelog --- .changes/8da6963b-713e-41fa-b8ff-6ea18629118b.json | 8 ++++++++ .github/workflows/test.yml | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .changes/8da6963b-713e-41fa-b8ff-6ea18629118b.json diff --git a/.changes/8da6963b-713e-41fa-b8ff-6ea18629118b.json b/.changes/8da6963b-713e-41fa-b8ff-6ea18629118b.json new file mode 100644 index 00000000000..d114842a7eb --- /dev/null +++ b/.changes/8da6963b-713e-41fa-b8ff-6ea18629118b.json @@ -0,0 +1,8 @@ +{ + "id": "8da6963b-713e-41fa-b8ff-6ea18629118b", + "type": "bugfix", + "description": "fixed a foo", + "issues": [ + "awslabs/aws-sdk-kotlin#1714" + ] +} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b17c2e3a66c..a441d6d6488 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,9 +60,12 @@ jobs: # TESTING # testing fetching issue number - PR_ISSUES=$(gh pr view "$pr_number" --json body --jq '.body' | \ - grep -o 'issues/[0-9]*' | \ - sed 's/issues\///') + # Get issue numbers from changelog entries in this PR + PR_ISSUES=$(gh pr view "$pr_number" --json files --jq '.files[].path' | \ + grep '\.changes/.*\.json$' | \ + xargs -I {} cat {} 2>/dev/null | \ + jq -r '.issues[]?' 2>/dev/null | \ + sed 's/.*#//') echo " Found issues: $PR_ISSUES" ISSUE_NUMBERS="$ISSUE_NUMBERS $PR_ISSUES" From cdb86e4d5e8575826adbcbb9ed0eea35eb2c52a2 Mon Sep 17 00:00:00 2001 From: Xinsong Cui Date: Mon, 20 Oct 2025 16:51:57 -0400 Subject: [PATCH 21/21] add pr link --- .changes/f3bee672-bc64-4103-adad-5f6db9e139a6.json | 8 ++++++++ .github/workflows/test.yml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changes/f3bee672-bc64-4103-adad-5f6db9e139a6.json diff --git a/.changes/f3bee672-bc64-4103-adad-5f6db9e139a6.json b/.changes/f3bee672-bc64-4103-adad-5f6db9e139a6.json new file mode 100644 index 00000000000..a3bdc05a5cc --- /dev/null +++ b/.changes/f3bee672-bc64-4103-adad-5f6db9e139a6.json @@ -0,0 +1,8 @@ +{ + "id": "f3bee672-bc64-4103-adad-5f6db9e139a6", + "type": "bugfix", + "description": "fixed a foo", + "issues": [ + "awslabs/aws-sdk-kotlin#2000" + ] +} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a441d6d6488..7158cf00436 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,7 +79,7 @@ jobs: 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**](https://github.com/${{ github.repository }}/releases/tag/$CURRENT_TAG)."; then + if ! gh issue comment "$issue_number" --body "A [#$pr_number](https://github.com/${{ github.repository }}/pull/$pr_number) related to this issue was included in [**$CURRENT_TAG**](https://github.com/${{ github.repository }}/releases/tag/$CURRENT_TAG)."; then echo "::error::Failed to comment on issue #$issue_number" FAILURES="$FAILURES #$issue_number" fi