@vavt/github-action-test 0.5.0 → 0.5.2
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.
- package/.github/workflows/latest.yml +79 -0
- package/CHANGELOG.md +48 -0
- package/package.json +1 -1
- package/src/main.jsx +1 -1
|
@@ -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:
|
|
@@ -190,3 +191,81 @@ jobs:
|
|
|
190
191
|
|
|
191
192
|
git commit -m "docs(changelog): update for ${TAG_NAME}"
|
|
192
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
|
+
ISSUE_STATE="$(printf '%s' "${ISSUE_PAYLOAD}" | jq -r '.state // ""')"
|
|
243
|
+
|
|
244
|
+
if gh api "repos/${GITHUB_REPOSITORY}/issues/${ISSUE_ID}/comments?per_page=100" \
|
|
245
|
+
--jq '.[] | select(.body | contains("'"${MARKER}"'")) | .id' \
|
|
246
|
+
| grep -q .; then
|
|
247
|
+
echo "Skip #${ISSUE_ID}: release notification already exists for ${TAG_NAME}."
|
|
248
|
+
continue
|
|
249
|
+
fi
|
|
250
|
+
|
|
251
|
+
COMMENT_BODY="$(printf '%s\n\n- Release: %s\n- Changelog: %s\n\n%s\n' \
|
|
252
|
+
"This issue is included in release \`${TAG_NAME}\`." \
|
|
253
|
+
"${RELEASE_URL}" \
|
|
254
|
+
"${CHANGELOG_URL}" \
|
|
255
|
+
"${MARKER}")"
|
|
256
|
+
|
|
257
|
+
gh api "repos/${GITHUB_REPOSITORY}/issues/${ISSUE_ID}/comments" \
|
|
258
|
+
--method POST \
|
|
259
|
+
-f "body=${COMMENT_BODY}" >/dev/null
|
|
260
|
+
|
|
261
|
+
echo "Notified issue #${ISSUE_ID}."
|
|
262
|
+
|
|
263
|
+
if [ "${ISSUE_STATE}" = "open" ]; then
|
|
264
|
+
gh api "repos/${GITHUB_REPOSITORY}/issues/${ISSUE_ID}" \
|
|
265
|
+
--method PATCH \
|
|
266
|
+
-f state=closed >/dev/null
|
|
267
|
+
echo "Closed issue #${ISSUE_ID}."
|
|
268
|
+
else
|
|
269
|
+
echo "Issue #${ISSUE_ID} already closed."
|
|
270
|
+
fi
|
|
271
|
+
done <<< "${ISSUE_IDS}"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
2
6
|
<!-- next-release -->
|
|
3
7
|
|
|
8
|
+
## 0.5.1 (2026-03-01)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
- None
|
|
13
|
+
|
|
14
|
+
### Refactors
|
|
15
|
+
|
|
16
|
+
- None
|
|
17
|
+
|
|
18
|
+
### Fixed Bugs
|
|
19
|
+
|
|
20
|
+
- 测试issue ([ab4da64](https://github.com/imzbf/github-action-test/commit/ab4da649f116e8e034fb2c2d04239f7c2b9636de))
|
|
21
|
+
|
|
22
|
+
### Others
|
|
23
|
+
|
|
24
|
+
- None
|
|
25
|
+
|
|
26
|
+
**Full Changelog**: [v0.5.0...v0.5.1](https://github.com/imzbf/github-action-test/compare/v0.5.0...v0.5.1)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 0.5.0 (2026-02-28)
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
- 每个版本块末尾保留 GitHub compare 链接 ([0253302](https://github.com/imzbf/github-action-test/commit/0253302b1443d710c39a41df36b4c55c0f53efb7))
|
|
35
|
+
|
|
36
|
+
### Refactors
|
|
37
|
+
|
|
38
|
+
- `Release` 链接指向 `CHANGELOG.md` ([778b93e](https://github.com/imzbf/github-action-test/commit/778b93e370c69d65c1091ccc459368411893ac27))
|
|
39
|
+
|
|
40
|
+
### Fixed Bugs
|
|
41
|
+
|
|
42
|
+
- 位置在四个分类之后、分割线之前 ([69af4cc](https://github.com/imzbf/github-action-test/commit/69af4ccf71929cc5b808bd0784e7ce5f77902f8a))
|
|
43
|
+
|
|
44
|
+
### Others
|
|
45
|
+
|
|
46
|
+
- chore: 另外已做 YAML 语法校验通过 ([025b625](https://github.com/imzbf/github-action-test/commit/025b62527821339f74ce0da72bd09caf4c968770))
|
|
47
|
+
|
|
48
|
+
**Full Changelog**: [v0.4.0...v0.5.0](https://github.com/imzbf/github-action-test/compare/v0.4.0...v0.5.0)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
4
52
|
## 0.4.0 (2026-02-28)
|
|
5
53
|
|
|
6
54
|
### Features
|
package/package.json
CHANGED
package/src/main.jsx
CHANGED