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

I keep getting tags instead of releases #589

Open
Dun-sin opened this issue Jan 30, 2023 · 7 comments
Open

I keep getting tags instead of releases #589

Dun-sin opened this issue Jan 30, 2023 · 7 comments

Comments

@Dun-sin
Copy link

Dun-sin commented Jan 30, 2023

Getting this error and I don't understand why

[9:29:33 AM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/npm"
[9:29:33 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/github"
[9:29:33 AM] [semantic-release] › ✖  Failed step "publish" of plugin "@semantic-release/github"
[9:29:33 AM] [semantic-release] › ✖  An error occurred while running semantic-release: RequestError [HttpError]: Bad credentials
    at /home/runner/work/DeepLearn/DeepLearn/node_modules/@octokit/request/dist-node/index.js:78:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  status: 401,
  response: {
    url: 'https://api.github.com/repos/Dun-sin/DeepLearn/releases',
    status: 401,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      connection: 'close',
      'content-length': '80',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Mon, 30 Jan 2023 09:29:33 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': 'BC18:8DBE:37E6F6:7355ED:63D78DFD',
      'x-ratelimit-limit': '60',
      'x-ratelimit-remaining': '59',
      'x-ratelimit-reset': '1675074573',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '1',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Bad credentials',
      documentation_url: 'https://docs.github.com/rest'
    }
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/Dun-sin/DeepLearn/releases',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/19.0.7 octokit-core.js/4.2.0 Node.js/16.19.0 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"tag_name":"v1.0.0","target_commitish":"main","name":"v1.0.0","body":"# 1.0.0 (2023-01-30)\\n\\n\\n### Features\\n\\n* add tailwind css and remove default code ([befb306](https://github.com/Dun-sin/DeepLearn/commit/befb30612cc2d9c8f8539f89d1a71a5aacbde8f5))\\n\\n\\n\\n","prerelease":false}',
    request: { agent: undefined, hook: [Function: bound bound register] }
  },
  pluginName: '@semantic-release/github'
}
RequestError [HttpError]: Bad credentials
    at /home/runner/work/DeepLearn/DeepLearn/node_modules/@octokit/request/dist-node/index.js:78:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  status: 401,
  response: {
    url: 'https://api.github.com/repos/Dun-sin/DeepLearn/releases',
    status: 401,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      connection: 'close',
      'content-length': '80',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Mon, 30 Jan 2023 09:29:33 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'GitHub.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': 'BC18:8DBE:37E6F6:7355ED:63D78DFD',
      'x-ratelimit-limit': '60',
      'x-ratelimit-remaining': '59',
      'x-ratelimit-reset': '1675074573',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '1',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Bad credentials',
      documentation_url: 'https://docs.github.com/rest'
    }
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/Dun-sin/DeepLearn/releases',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-rest.js/19.0.7 octokit-core.js/4.2.0 Node.js/16.19.0 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-type': 'application/json; charset=utf-8'
    },
    body: '{"tag_name":"v1.0.0","target_commitish":"main","name":"v1.0.0","body":"# 1.0.0 (2023-01-30)\\n\\n\\n### Features\\n\\n* add tailwind css and remove default code ([befb306](https://github.com/Dun-sin/DeepLearn/commit/befb30612cc2d9c8f8539f89d1a71a5aacbde8f5))\\n\\n\\n\\n","prerelease":false}',
    request: { agent: undefined, hook: [Function: bound bound register] }
  },
  pluginName: '@semantic-release/github'
}
Error: Process completed with exit code 1.```
@ianaa
Copy link

ianaa commented Feb 15, 2023

@Dun-sin have you found a solution to this issue? my semantic-release workflows started failing recently and I also don't understand the reason. The release commit and the tag are pushed to the repo, the new package version is published to npm, but creating a github release fails.

@Dun-sin
Copy link
Author

Dun-sin commented Feb 15, 2023

@ianaa that's exactly what's happening to me, but sadly I haven't found a solution yet

@travi
Copy link
Member

travi commented Feb 16, 2023

ensure that the token that you are providing to semantic-release has contents-write permission

@Dun-sin
Copy link
Author

Dun-sin commented Feb 16, 2023

ensure that the token that you are providing to semantic-release has contents-write permission

I cross-checked that, and the token has the proper permissions, do you think there's something else I'm missing?

@travi
Copy link
Member

travi commented Feb 16, 2023

either your token does not have the proper permissions, or your pipeline is passing the wrong token to semantic-release. perhaps you need to set persist-credentials to false? see https://semantic-release.gitbook.io/semantic-release/recipes/ci-configurations/github-actions#pushing-package.json-changes-to-a-master-branch

@jwalker2022
Copy link

When Github says their fine grained access tokens are beta, they mean it. A heads up for anyone integrating Github plugins into your repository: do not use the fine grained access tokens. (They labeled by Github as beta) They create flustering results; for example, I have hunted through Github issues and tried various Github actions to determine why the skeleton repository's workflow's semantic-release job failed. Come to find out, the token didn't grant write access to the repository even though I authorized the token, the fine-grained token, for the repository. So I switched back to the classic token; the semantic-release job parsed the commits and published a release. 🙌:skin-tone-6:

Oh, and Github fails with a 404 error. The only way I found the authorization error was I configured the workflow job to no longer persist credentials to the repository. Then the workflow provided a more descriptive error message: stderr: 'remote: Write access to repository not granted.\n'. After reading that I obliterated the fine-grain access token for a classic token. Everything worked perfectly.

@Dun-sin
Copy link
Author

Dun-sin commented Mar 7, 2023

I think it's an issue from the project itself, because I didn't have to do anything, and it's working again

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

4 participants