@vavt/github-action-test 0.2.0 → 0.4.0

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.
@@ -50,17 +50,13 @@ jobs:
50
50
  - name: Update CHANGELOG.md
51
51
  continue-on-error: true
52
52
  env:
53
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54
53
  TAG_NAME: ${{ github.ref_name }}
55
54
  DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
56
55
  run: |
57
56
  set -euo pipefail
58
57
 
59
58
  if [ ! -f CHANGELOG.md ]; then
60
- printf '%s\n\n%s\n\n%s\n' \
61
- '# Changelog' \
62
- 'All notable changes to this project will be documented in this file.' \
63
- '<!-- next-release -->' > CHANGELOG.md
59
+ printf '%s\n' '<!-- next-release -->' > CHANGELOG.md
64
60
  fi
65
61
 
66
62
  DISPLAY_VERSION="${TAG_NAME#v}"
@@ -70,58 +66,89 @@ jobs:
70
66
  exit 0
71
67
  fi
72
68
 
73
- NOTES="$(gh release view "${TAG_NAME}" --json body --jq '.body')"
74
69
  DATE="$(date -u +%Y-%m-%d)"
75
70
  MARKER='<!-- next-release -->'
71
+ REPO_URL="https://github.com/${GITHUB_REPOSITORY}"
76
72
 
77
- printf '%s\n' "${NOTES}" | sed 's/\r$//' > /tmp/release-notes.raw.md
78
-
79
- sed \
80
- -e "/^## What's Changed$/d" \
81
- -e '/^## New Contributors$/,/^\*\*Full Changelog\*\*/d' \
82
- -e '/^\*\*Full Changelog\*\*/d' \
83
- -e 's/^\* /- /' \
84
- /tmp/release-notes.raw.md > /tmp/release-notes.cleaned.md
85
-
86
- awk '
87
- BEGIN { started = 0 }
88
- {
89
- if (!started && $0 ~ /^[[:space:]]*$/) {
90
- next
91
- }
92
- started = 1
93
- lines[++n] = $0
94
- }
95
- END {
96
- while (n > 0 && lines[n] ~ /^[[:space:]]*$/) {
97
- n--
98
- }
99
- for (i = 1; i <= n; i++) {
100
- print lines[i]
101
- }
102
- }
103
- ' /tmp/release-notes.cleaned.md > /tmp/release-notes.trimmed.md
104
-
105
- mv /tmp/release-notes.trimmed.md /tmp/release-notes.cleaned.md
106
-
107
- if [ ! -s /tmp/release-notes.cleaned.md ]; then
108
- printf '### Changes\n\n- Internal maintenance updates.\n' > /tmp/release-notes.cleaned.md
109
- elif ! grep -q '^### ' /tmp/release-notes.cleaned.md; then
110
- {
111
- printf '### Changes\n\n'
112
- cat /tmp/release-notes.cleaned.md
113
- } > /tmp/release-notes.with-section.md
114
- mv /tmp/release-notes.with-section.md /tmp/release-notes.cleaned.md
73
+ PREV_TAG="$(git tag --list 'v*' --sort=-creatordate | grep -Fxv "${TAG_NAME}" | head -n1 || true)"
74
+
75
+ if [ -n "${PREV_TAG}" ]; then
76
+ RANGE="${PREV_TAG}..${TAG_NAME}"
77
+ else
78
+ ROOT_COMMIT="$(git rev-list --max-parents=0 "${TAG_NAME}" | tail -n1)"
79
+ RANGE="${ROOT_COMMIT}..${TAG_NAME}"
115
80
  fi
116
81
 
82
+ FEATURES_FILE='/tmp/changelog-features.md'
83
+ REFACTORS_FILE='/tmp/changelog-refactors.md'
84
+ FIXES_FILE='/tmp/changelog-fixed-bugs.md'
85
+ OTHERS_FILE='/tmp/changelog-others.md'
86
+ : > "${FEATURES_FILE}"
87
+ : > "${REFACTORS_FILE}"
88
+ : > "${FIXES_FILE}"
89
+ : > "${OTHERS_FILE}"
90
+
91
+ while IFS=$'\t' read -r FULL_HASH SUBJECT; do
92
+ [ -z "${FULL_HASH:-}" ] && continue
93
+ SUBJECT="$(printf '%s' "${SUBJECT}" | sed -E 's/^[[:space:]]+|[[:space:]]+$//g')"
94
+ [ -z "${SUBJECT}" ] && continue
95
+
96
+ # Skip auto-generated changelog commits.
97
+ if printf '%s' "${SUBJECT}" | grep -Eiq '^docs\(changelog\):[[:space:]]*'; then
98
+ continue
99
+ fi
100
+
101
+ # Skip plain version bump commits such as "0.3.0" or "v0.3.0-beta.1".
102
+ if printf '%s' "${SUBJECT}" | grep -Eq '^v?[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$'; then
103
+ continue
104
+ fi
105
+
106
+ TARGET_FILE="${OTHERS_FILE}"
107
+ CLEAN_SUBJECT="${SUBJECT}"
108
+
109
+ if printf '%s' "${SUBJECT}" | grep -Eiq '^feat(\([^)]*\))?(!)?:[[:space:]]*'; then
110
+ TARGET_FILE="${FEATURES_FILE}"
111
+ CLEAN_SUBJECT="$(printf '%s' "${SUBJECT}" | sed -E 's/^feat(\([^)]*\))?(!)?:[[:space:]]*//I')"
112
+ elif printf '%s' "${SUBJECT}" | grep -Eiq '^refactor(\([^)]*\))?(!)?:[[:space:]]*'; then
113
+ TARGET_FILE="${REFACTORS_FILE}"
114
+ CLEAN_SUBJECT="$(printf '%s' "${SUBJECT}" | sed -E 's/^refactor(\([^)]*\))?(!)?:[[:space:]]*//I')"
115
+ elif printf '%s' "${SUBJECT}" | grep -Eiq '^fix(\([^)]*\))?(!)?:[[:space:]]*'; then
116
+ TARGET_FILE="${FIXES_FILE}"
117
+ CLEAN_SUBJECT="$(printf '%s' "${SUBJECT}" | sed -E 's/^fix(\([^)]*\))?(!)?:[[:space:]]*//I')"
118
+ fi
119
+
120
+ if [ -z "${CLEAN_SUBJECT}" ]; then
121
+ CLEAN_SUBJECT="${SUBJECT}"
122
+ fi
123
+
124
+ SHORT_HASH="$(printf '%s' "${FULL_HASH}" | cut -c1-7)"
125
+ printf -- '- %s ([%s](%s/commit/%s))\n' "${CLEAN_SUBJECT}" "${SHORT_HASH}" "${REPO_URL}" "${FULL_HASH}" >> "${TARGET_FILE}"
126
+ done < <(git log "${RANGE}" --no-merges --format='%H%x09%s' || true)
127
+
128
+ write_section() {
129
+ local title="$1"
130
+ local file="$2"
131
+ printf '### %s\n\n' "${title}"
132
+ if [ -s "${file}" ]; then
133
+ cat "${file}"
134
+ else
135
+ printf -- '- None\n'
136
+ fi
137
+ printf '\n'
138
+ }
139
+
117
140
  {
118
141
  printf '## %s (%s)\n\n' "${DISPLAY_VERSION}" "${DATE}"
119
- printf -- '---\n\n'
120
- cat /tmp/release-notes.cleaned.md
121
- printf '\n'
142
+ write_section 'Features' "${FEATURES_FILE}"
143
+ write_section 'Refactors' "${REFACTORS_FILE}"
144
+ write_section 'Fixed Bugs' "${FIXES_FILE}"
145
+ write_section 'Others' "${OTHERS_FILE}"
146
+ printf -- '---\n'
122
147
  } > /tmp/release-entry.md
123
148
 
124
- grep -vF "${MARKER}" CHANGELOG.md > /tmp/changelog-base.md || true
149
+ grep -vF "${MARKER}" CHANGELOG.md \
150
+ | sed '/^# Changelog$/d; /^All notable changes to this project will be documented in this file\.$/d' \
151
+ > /tmp/changelog-base.md || true
125
152
 
126
153
  FIRST_SECTION_LINE="$(grep -n '^## ' /tmp/changelog-base.md | head -n1 | cut -d: -f1 || true)"
127
154
 
package/CHANGELOG.md CHANGED
@@ -1,15 +1,36 @@
1
- # Changelog
1
+ ## 0.3.0 (2026-02-28)
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ ---
4
4
 
5
+ ### Features
5
6
 
6
- <!-- next-release -->
7
+ - 1 ([628542d](https://github.com/imzbf/github-action-test/commit/628542dd686122cf5c05b2a3d231692087f30861))
7
8
 
8
- ## v0.1.0 (2026-02-28)
9
+ ### Refactors
9
10
 
10
- <!-- Release notes generated using configuration in .github/release.yml at v0.1.0 -->
11
+ - 2333333333 ([f8ebff7](https://github.com/imzbf/github-action-test/commit/f8ebff719f0b6f9e9c10dd824e8a7d0d326ae5eb))
12
+
13
+ ### Fixed Bugs
14
+
15
+ - 2222222 ([1b7b249](https://github.com/imzbf/github-action-test/commit/1b7b2499f100e8a8da344d74c51077d208002801))
16
+
17
+ ### Others
11
18
 
19
+ - 0.3.0 ([886b5ab](https://github.com/imzbf/github-action-test/commit/886b5abf9bcb13dffeab71c54a67bd848cca4401))
20
+ - ci: 更新日志收集方式 ([c546734](https://github.com/imzbf/github-action-test/commit/c5467346c43414c9032149a88c88a5842fb18dbe))
21
+ - docs(changelog): update for v0.2.0 ([b885f00](https://github.com/imzbf/github-action-test/commit/b885f00a683fad0c172bdc1a8ea1445e6c6a91ee))
12
22
 
23
+ ## 0.2.0 (2026-02-28)
24
+
25
+ ---
26
+
27
+ ### Changes
28
+
29
+ <!-- Release notes generated using configuration in .github/release.yml at v0.2.0 -->
30
+
31
+ ## v0.1.0 (2026-02-28)
32
+
33
+ <!-- Release notes generated using configuration in .github/release.yml at v0.1.0 -->
13
34
 
14
35
  **Full Changelog**: https://github.com/imzbf/github-action-test/compare/v0.0.5...v0.1.0
15
36
 
@@ -17,23 +38,16 @@ All notable changes to this project will be documented in this file.
17
38
 
18
39
  <!-- Release notes generated using configuration in .github/release.yml at v0.0.3 -->
19
40
 
20
-
21
-
22
41
  **Full Changelog**: https://github.com/imzbf/github-action-test/compare/v0.0.2...v0.0.3
23
42
 
24
43
  ## v0.0.4 (2026-02-28)
25
44
 
26
45
  <!-- Release notes generated using configuration in .github/release.yml at v0.0.4 -->
27
46
 
28
-
29
-
30
47
  **Full Changelog**: https://github.com/imzbf/github-action-test/compare/v0.0.3...v0.0.4
31
48
 
32
49
  ## v0.0.5 (2026-02-28)
33
50
 
34
51
  <!-- Release notes generated using configuration in .github/release.yml at v0.0.5 -->
35
52
 
36
-
37
-
38
53
  **Full Changelog**: https://github.com/imzbf/github-action-test/compare/v0.0.4...v0.0.5
39
-
package/README.md CHANGED
@@ -0,0 +1 @@
1
+ # 111
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vavt/github-action-test",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
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, World! 004');
2
+ console.log('Hello, Wor22ld! 022404');
3
3
  };
4
4
 
5
5
  hello();