question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GitHub Action support

See original GitHub issue

I’d like to make semantic-release work within GitHub actions out of the box

action "npx semantic-release" {
  uses = "docker://timbru31/node-alpine-git"
  runs = "npx"
  args = "semantic-release"
  secrets = ["GITHUB_TOKEN", "NPM_TOKEN"]
}

The NPM_TOKEN needs to be configured, but GITHUB_TOKEN should work with the one provided by GitHub action.

But when I run the action, I get the following error

EGHNOPERMISSION The GitHub token doesn’t allow to push on the repository octokit/routes

The problem is that the token is not an OAuth token, but an GitHub App installation access token, because that’s how it’s implemented I assume.

The verification works by checking the respone of github.repos.get() which for the GitHub Action returns

...
  "permissions": {
    "admin": false,
    "push": false,
    "pull": false
  },

Although the token has code write permission to the repository.

The token itself is easily distinguished: it starts with v1., e.g. v1.1234567890123456789012345678901234567890.

We could also just check if process.env.GITHUB_ACTION is set, see Environment variables. But people can pass their own tokens so that’s not guaranteed.

I’d suggest we check for both.

If both is true, we can just assume that it has write access.

I’ll do some testing myself

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pvdlgcommented, Jun 5, 2019

Ok. Checking isNil(env.GITHUB_ACTION) seems better than checking for v1 in the token. I’m guessing GitHub can change the format of token anytime (at some point it will be come v2 I imagine).

1reaction
gr2mcommented, Oct 18, 2019

You need to set the GITHUB_TOKEN environment variable from secrets.GITHUB_TOKEN. See https://github.com/octokit/core.js/blob/master/.github/workflows/release.yml for reference

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub Actions Support
GitHub Support is here to help. Learn about GitHub products, browse our helpful resources, and contact support with your questions.
Read more >
Support Requests · Actions · GitHub Marketplace
Support Requests is a GitHub Action that comments on and closes issues labeled as support requests. Supporting the Project. The continued development of...
Read more >
GitHub Actions Documentation
Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. You can discover, create, and share ...
Read more >
GitHub Support
GitHub Support is here to help. Learn about GitHub products, browse our helpful resources, and contact support with your questions.
Read more >
Actions - GitHub Docs
Use the REST API to interact with GitHub Actions for an organization or repository.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found