Skip to content

semantic-release(/git) not using GH_TOKEN #196

Open
@imduchy

Description

@imduchy

We're trying to push a commit to the protected master-test branch with Github Actions after a pull request is merged (on push to master-test). I generated a personal token with appropriate access to our repo (having an admin role) but noticed that the token is probably not being used (in Personal access token settings on GitHub).

image

I went through the documentation, followed each step, but still can't make it work. I've also tried to use GIT_CREDENTIALS env variable, without success.

We're using:

  • "semantic-release": "^17.0.4"
  • "@semantic-release/git": "^9.0.0"

release.config.js

/* eslint-disable @typescript-eslint/no-var-requires */

module.exports = {
	branches: [
		'master-test'
	],
	plugins: [
		"@semantic-release/commit-analyzer",
		"@semantic-release/release-notes-generator",
		"@semantic-release/npm",
		["@semantic-release/github", {
			"assets": ["dist/**"]
		}],
		["@semantic-release/git", {
			"assets": ["dist/**/*.{js,css}", "docs", "package.json"],
			"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
		}]
	  ],
}

action setup

- name: Semantic Release
run: yarn semantic-release #runs "semantic-release --debug"
env:
  NODE_ENV: production
  GH_TOKEN: ${{ secrets.GH_TOKEN }}
  GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
  NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
  NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

output from the job

shortMessage: 'Command failed with exit code 1: git push --tags https://github.com/xxx/xxx.git HEAD:master-test',
command: 'git push --tags https://github.com/xxx/xxx.git HEAD:master-test',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: 'remote: error: GH006: Protected branch update failed for refs/heads/master-test. \n' +
"remote: error: You're not authorized to push to this branch. Visit https://help.github.com/articles/about-protected-branches/ for more information. \n" +
'To https://github.com/xxx/xxx.git\n' +
' ! [remote rejected] HEAD -> master-test (protected branch hook declined)\n' +
"error: failed to push some refs to 'https://github.com/xxx/xxx.git'",
failed: true,
timedOut: false,
isCanceled: false,
killed: false,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions