@vavt/github-action-test 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ on:
7
7
 
8
8
  permissions:
9
9
  contents: write
10
+ issues: write
10
11
 
11
12
  jobs:
12
13
  publish:
@@ -44,6 +45,8 @@ jobs:
44
45
  tag_name: ${{ github.ref_name }}
45
46
  generate_release_notes: true
46
47
  make_latest: true
48
+ body: |
49
+ See full changelog in [`CHANGELOG.md`](https://github.com/${{ github.repository }}/blob/${{ github.event.repository.default_branch }}/CHANGELOG.md).
47
50
  env:
48
51
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49
52
 
@@ -74,11 +77,15 @@ jobs:
74
77
 
75
78
  if [ -n "${PREV_TAG}" ]; then
76
79
  RANGE="${PREV_TAG}..${TAG_NAME}"
80
+ COMPARE_FROM="${PREV_TAG}"
77
81
  else
78
82
  ROOT_COMMIT="$(git rev-list --max-parents=0 "${TAG_NAME}" | tail -n1)"
79
83
  RANGE="${ROOT_COMMIT}..${TAG_NAME}"
84
+ COMPARE_FROM="${ROOT_COMMIT}"
80
85
  fi
81
86
 
87
+ COMPARE_URL="${REPO_URL}/compare/${COMPARE_FROM}...${TAG_NAME}"
88
+
82
89
  FEATURES_FILE='/tmp/changelog-features.md'
83
90
  REFACTORS_FILE='/tmp/changelog-refactors.md'
84
91
  FIXES_FILE='/tmp/changelog-fixed-bugs.md'
@@ -143,6 +150,7 @@ jobs:
143
150
  write_section 'Refactors' "${REFACTORS_FILE}"
144
151
  write_section 'Fixed Bugs' "${FIXES_FILE}"
145
152
  write_section 'Others' "${OTHERS_FILE}"
153
+ printf '**Full Changelog**: [%s...%s](%s)\n\n' "${COMPARE_FROM}" "${TAG_NAME}" "${COMPARE_URL}"
146
154
  printf -- '---\n'
147
155
  } > /tmp/release-entry.md
148
156
 
@@ -183,3 +191,70 @@ jobs:
183
191
 
184
192
  git commit -m "docs(changelog): update for ${TAG_NAME}"
185
193
  git push origin "HEAD:${DEFAULT_BRANCH}"
194
+
195
+ - name: Notify Linked Issues
196
+ continue-on-error: true
197
+ env:
198
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
199
+ TAG_NAME: ${{ github.ref_name }}
200
+ DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
201
+ run: |
202
+ set -euo pipefail
203
+
204
+ PREV_TAG="$(git tag --list 'v*' --sort=-creatordate | grep -Fxv "${TAG_NAME}" | head -n1 || true)"
205
+
206
+ if [ -n "${PREV_TAG}" ]; then
207
+ RANGE="${PREV_TAG}..${TAG_NAME}"
208
+ else
209
+ ROOT_COMMIT="$(git rev-list --max-parents=0 "${TAG_NAME}" | tail -n1)"
210
+ RANGE="${ROOT_COMMIT}..${TAG_NAME}"
211
+ fi
212
+
213
+ ISSUE_IDS="$(
214
+ git log "${RANGE}" --no-merges --format='%s%n%b%n' \
215
+ | perl -ne 'while(/(?:^|[^A-Za-z0-9_])#([0-9]+)\b/g){print "$1\n"}' \
216
+ | sort -n -u
217
+ )"
218
+
219
+ if [ -z "${ISSUE_IDS}" ]; then
220
+ echo "No linked issues found in commit messages."
221
+ exit 0
222
+ fi
223
+
224
+ RELEASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/tag/${TAG_NAME}"
225
+ CHANGELOG_URL="https://github.com/${GITHUB_REPOSITORY}/blob/${DEFAULT_BRANCH}/CHANGELOG.md"
226
+ MARKER="<!-- release-notify:${TAG_NAME} -->"
227
+
228
+ while IFS= read -r ISSUE_ID; do
229
+ [ -z "${ISSUE_ID}" ] && continue
230
+
231
+ ISSUE_PAYLOAD="$(gh api "repos/${GITHUB_REPOSITORY}/issues/${ISSUE_ID}" 2>/dev/null || true)"
232
+ if [ -z "${ISSUE_PAYLOAD}" ]; then
233
+ echo "Skip #${ISSUE_ID}: issue not found or inaccessible."
234
+ continue
235
+ fi
236
+
237
+ if printf '%s' "${ISSUE_PAYLOAD}" | jq -e '.pull_request != null' >/dev/null; then
238
+ echo "Skip #${ISSUE_ID}: reference is a pull request."
239
+ continue
240
+ fi
241
+
242
+ if gh api "repos/${GITHUB_REPOSITORY}/issues/${ISSUE_ID}/comments?per_page=100" \
243
+ --jq '.[] | select(.body | contains("'"${MARKER}"'")) | .id' \
244
+ | grep -q .; then
245
+ echo "Skip #${ISSUE_ID}: release notification already exists for ${TAG_NAME}."
246
+ continue
247
+ fi
248
+
249
+ COMMENT_BODY="$(printf '%s\n\n- Release: %s\n- Changelog: %s\n\n%s\n' \
250
+ "This issue is included in release \`${TAG_NAME}\`." \
251
+ "${RELEASE_URL}" \
252
+ "${CHANGELOG_URL}" \
253
+ "${MARKER}")"
254
+
255
+ gh api "repos/${GITHUB_REPOSITORY}/issues/${ISSUE_ID}/comments" \
256
+ --method POST \
257
+ -f "body=${COMMENT_BODY}" >/dev/null
258
+
259
+ echo "Notified issue #${ISSUE_ID}."
260
+ done <<< "${ISSUE_IDS}"
package/CHANGELOG.md CHANGED
@@ -1,3 +1,50 @@
1
+
2
+
3
+
4
+ <!-- next-release -->
5
+
6
+ ## 0.5.0 (2026-02-28)
7
+
8
+ ### Features
9
+
10
+ - 每个版本块末尾保留 GitHub compare 链接 ([0253302](https://github.com/imzbf/github-action-test/commit/0253302b1443d710c39a41df36b4c55c0f53efb7))
11
+
12
+ ### Refactors
13
+
14
+ - `Release` 链接指向 `CHANGELOG.md` ([778b93e](https://github.com/imzbf/github-action-test/commit/778b93e370c69d65c1091ccc459368411893ac27))
15
+
16
+ ### Fixed Bugs
17
+
18
+ - 位置在四个分类之后、分割线之前 ([69af4cc](https://github.com/imzbf/github-action-test/commit/69af4ccf71929cc5b808bd0784e7ce5f77902f8a))
19
+
20
+ ### Others
21
+
22
+ - chore: 另外已做 YAML 语法校验通过 ([025b625](https://github.com/imzbf/github-action-test/commit/025b62527821339f74ce0da72bd09caf4c968770))
23
+
24
+ **Full Changelog**: [v0.4.0...v0.5.0](https://github.com/imzbf/github-action-test/compare/v0.4.0...v0.5.0)
25
+
26
+ ---
27
+
28
+ ## 0.4.0 (2026-02-28)
29
+
30
+ ### Features
31
+
32
+ - 1 ([3d0c750](https://github.com/imzbf/github-action-test/commit/3d0c75081edc8a6238bbfd8c8cdecde87e53f752))
33
+
34
+ ### Refactors
35
+
36
+ - 33333333 ([fe2153a](https://github.com/imzbf/github-action-test/commit/fe2153af62cac3681babd16fd777734f926f5bce))
37
+
38
+ ### Fixed Bugs
39
+
40
+ - 123123123123 ([ad380fe](https://github.com/imzbf/github-action-test/commit/ad380feabda632877594429b9d9e86f5558527c3))
41
+
42
+ ### Others
43
+
44
+ - docs: 123123 ([24cf69b](https://github.com/imzbf/github-action-test/commit/24cf69b730c671cf22c37b29eb25fff123d8a6fd))
45
+
46
+ ---
47
+
1
48
  ## 0.3.0 (2026-02-28)
2
49
 
3
50
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vavt/github-action-test",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
package/src/main.jsx CHANGED
@@ -1,5 +1,5 @@
1
1
  const hello = () => {
2
- console.log('Hello, Wor22ld! 022404');
2
+ console.log('Hello, ! 022404');
3
3
  };
4
4
 
5
5
  hello();