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

Support GITHUB_TOKEN provided by GitHub Actions #4176

Closed
nathany opened this issue Aug 22, 2019 · 5 comments · Fixed by #4225

Comments

@nathany
Copy link

commented Aug 22, 2019

  • Version: 21.2.0
  • Target: macOS

I'm attempting to build an Electron app using GitHub Actions. A GITHUB_TOKEN is provided which could possibly be used instead of creating a personal access token.

- name: Publish release
  run: npm run release
  env:
    GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

However, the following error occurs:

Error: GitHub Personal Access Token ("***") contains invalid characters, please check env "GH_TOKEN"
at new GitHubPublisher (/Users/runner/runners/2.157.0/work/tailboard-electron/tailboard-electron/node_modules/electron-publish/src/gitHubPublisher.ts:53:15)

@judge2020

This comment has been minimized.

Copy link
Contributor

commented Sep 10, 2019

I encoded it into hex to be able to extract the integration token from the output (they block base64-based exfiltration though) and the format is v1.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; the part after v1. is 40 characters long, the same length as regular personal access tokens. However, after some testing, you can't use this token without the v1. in front of it without getting 401 unauthorized.

The regex needs to be updated to allow the period.

return /^[\w\/=+-]+$/.test(token)

gmaclennan added a commit to digidem/mapeo-desktop that referenced this issue Sep 12, 2019
@judge2020

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2019

For a temporary, cross-platform fix, a step like this should allow the new token format to work. Since sed exits with code 0 even if no replacement occurred, this won't break when the PR is merged.

      - name: Temporarily fix electron-builder
        run: |
          sed -i 's/\^\[\\w/\^\[.\\w/g' node_modules/builder-util/out/util.js
        shell: bash
develar added a commit that referenced this issue Sep 23, 2019
@nathany

This comment has been minimized.

Copy link
Author

commented Sep 23, 2019

thanks

@stephan-nordnes-eriksen

This comment has been minimized.

Copy link

commented Oct 2, 2019

@judge2020 :

On MacOS you need the following syntax for sed to work

- name: Temporarily fix electron-builder
  run: |
    sed -i '' 's/\^\[\\w/\^\[.\\w/g' node_modules/builder-util/out/util.js
  shell: bash
@Stanzilla

This comment has been minimized.

Copy link

commented Oct 9, 2019

@develar can we get a release with that fix?

Stanzilla added a commit to WeakAuras/WeakAuras-Companion that referenced this issue Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.