Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use github action deploy package into npm with semantic-release get error when project in github organization repository #3093

Open
hefeng6500 opened this issue Dec 7, 2023 · 0 comments

Comments

@hefeng6500
Copy link

Error Log Link This:

Run npx semantic-release
[3:35:05 AM] [semantic-release] › ℹ  Running semantic-release version 22.0.10
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/npm"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "verifyConditions" from "@semantic-release/github"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "prepare" from "@semantic-release/npm"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/npm"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "publish" from "@semantic-release/github"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/npm"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "addChannel" from "@semantic-release/github"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "success" from "@semantic-release/github"
[3:35:05 AM] [semantic-release] › ✔  Loaded plugin "fail" from "@semantic-release/github"
[3:35:06 AM] [semantic-release] › ✔  Run automated release from branch main on repository https://github.com/HeFeng-Lab/core-cli.git
[3:35:06 AM] [semantic-release] › ✘  The command "git push --dry-run --no-verify https://x-access-token:[secure]@github.com/HeFeng-Lab/core-cli.git HEAD:main" failed with the error message remote: Permission to HeFeng-Lab/core-cli.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/HeFeng-Lab/core-cli.git/': The requested URL returned error: 403.
[3:35:06 AM] [semantic-release] › ℹ  Start step "fail" of plugin "@semantic-release/github"
[3:35:06 AM] [semantic-release] [@semantic-release/github] › ℹ  Verify GitHub authentication (https://api.github.com)
[3:35:07 AM] [semantic-release] [@semantic-release/github] › ℹ  Found existing semantic-release issue #1.
[3:35:07 AM] [semantic-release] [@semantic-release/github] › ℹ  Added comment to issue #1: https://github.com/HeFeng-Lab/core-cli/issues/1#issuecomment-1844201022.
[3:35:07 AM] [semantic-release] › ✔  Completed step "fail" of plugin "@semantic-release/github"
[3:35:07 AM] [semantic-release] › ✘  EGITNOPERMISSION Cannot push to the Git repository.
semantic-release cannot push the version tag to the branch main on the remote Git repository with URL https://x-access-token:[secure]@github.com/HeFeng-Lab/core-cli.git.

This can be caused by:

    * a misconfiguration of the repositoryUrl (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#repositoryurl) option
    * the repository being unavailable
    * or missing push permission for the user configured via the Git credentials on your CI environment (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication)

SemanticReleaseError: Cannot push to the Git repository.
    at default (file:///home/runner/work/core-cli/core-cli/node_modules/semantic-release/lib/get-error.js:6:10)
    at run (file:///home/runner/work/core-cli/core-cli/node_modules/semantic-release/index.js:101:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:[9](https://github.com/HeFeng-Lab/core-cli/actions/runs/7123361958/job/19396058951#step:5:10)5:5)
    at async Module.default (file:///home/runner/work/core-cli/core-cli/node_modules/semantic-release/index.js:275:[22](https://github.com/HeFeng-Lab/core-cli/actions/runs/7123361958/job/19396058951#step:5:23))
    at async default (file:///home/runner/work/core-cli/core-cli/node_modules/semantic-release/cli.js:55:5) {
  code: 'EGITNOPERMISSION',
  details: '**semantic-release** cannot push the version tag to the branch `main` on the remote Git repository with URL `https://x-access-token:[secure]@github.com/HeFeng-Lab/core-cli.git`.\n' +
    '\n' +
    'This can be caused by:\n' +
    ' - a misconfiguration of the [repositoryUrl](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#repositoryurl) option\n' +
    ' - the repository being unavailable\n' +
    ' - or missing push permission for the user configured via the [Git credentials on your CI environment](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication)',
  semanticRelease: true
}
Error: Process completed with exit code 1.

npm-publish config

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
  push:
    branches:
      - main
  # release:
  # types: [created]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source code
        uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20.10.0
      - run: npm ci

  publish-npm:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source code
        uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20.10.0
          registry-url: https://registry.npmjs.org/

      - name: Install dependencies
        run: npm ci

      - name: Semantic Release
        env:
          GITHUB_TOKEN: ${{secrets.GH_TOKEN}}
          NPM_TOKEN: ${{secrets.NPM_TOKEN}}
        run: npx semantic-release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant