From 925990b613a70dd9d6eb1c8c8ed629ae9b3a870b Mon Sep 17 00:00:00 2001 From: Ashton Eby Date: Tue, 22 Oct 2024 13:02:41 -0700 Subject: [PATCH] use a workflow step instead of node script to commit changes --- .github/workflows/npm-publish.yml | 9 +++++++++ scripts/version-bump.js | 3 --- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index add88fd..7f0c2f3 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -11,6 +11,11 @@ jobs: build: runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + steps: - uses: actions/checkout@v4 - name: Use Node.js (22.x) @@ -21,6 +26,10 @@ jobs: cache: 'npm' - run: npm ci - run: npm run bump + # Commit changes to package.json back to the repository + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + file_pattern: 'package.json' - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/scripts/version-bump.js b/scripts/version-bump.js index 2ce02fe..701539f 100755 --- a/scripts/version-bump.js +++ b/scripts/version-bump.js @@ -27,6 +27,3 @@ if (scope === 'patch' || ['fix', 'chore', 'docs', 'refactor', 'perf', 'test', 'b } execSync(`npm version ${flag}`); -execSync("git add package.json"); -execSync("git commit --amend --no-edit"); -execSync("git push --force");