Skip to content

Commit 7a865b5

Browse files
authored
Update package-update.yml
1 parent 98f521d commit 7a865b5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

.github/workflows/package-update.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,23 @@ jobs:
3737
if (!PKG) throw new Error("Missing $PKG")
3838
if (!VERSION) throw new Error("Missing $VERSION")
3939
const pkg = JSON.parse(fs.readFileSync("package.json"))
40+
console.log(`old version=${pkg.dependencies[PKG]}`)
4041
pkg.dependencies[PKG] = VERSION
41-
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2))
42+
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2)+"\n")
4243
- name: Update package-lock.json
4344
run: npm update "$PKG" --lock-file-only
4445
env:
4546
PKG: ${{ inputs.package }}
4647
- name: Commit and push changes
4748
run: |
4849
set -euo pipefail
49-
if git diff-index --quiet --cached HEAD; then
50-
echo '::warning::No changes detected. Skipping push.'
51-
else
50+
if git add package.json package-lock.json; then
5251
git config --global user.name "$ACTOR (on behalf of $TRIGGERING_ACTOR)"
5352
git config --global user.email "$ACTOR@users.noreply.github.com"
54-
git commit --all --message "Update $PKG to $VERSION"
53+
git commit --message "Update $PKG to $VERSION"
5554
git push
55+
else
56+
echo '::warning::No changes detected. Skipping push.'
5657
fi
5758
env:
5859
PKG: ${{ inputs.package }}

0 commit comments

Comments
 (0)