Skip to content

Commit

Permalink
use an amend commit instead of an additional commit
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo committed Oct 22, 2024
1 parent ada6dbb commit 11bfae2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
# Fetch the last 2 commits instead of just 1. (Fetching just 1 commit would overwrite the whole history)
fetch-depth: 2
- name: Use Node.js (22.x)
uses: actions/setup-node@v4
with:
Expand All @@ -27,10 +30,20 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run bump
- name: Get last commit message
id: last-commit
run: |
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
echo "author=$(git log -1 --pretty=\"%an <%ae>\")" >> $GITHUB_OUTPUT
# Commit changes to package.json back to the repository
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_author: ${{ steps.last-commit.outputs.author }}
file_pattern: 'package.json'
commit_message: ${{ steps.last-commit.outputs.message }}
commit_options: '--amend --no-edit'
push_options: '--force'
skip_fetch: true
- run: npm publish --access public --loglevel verbose --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 11bfae2

Please sign in to comment.