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)
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.
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
thanks
@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
@develar can we get a release with that fix?
This is still happening with v21.2.0 (GitHub Actions on Ubuntu):
⨯ GitHub Personal Access Token ("***") contains invalid characters, please check env "GH_TOKEN"
@samuelmeuli in https://github.com/samuelmeuli/mini-diary/blob/master/.github/workflows/release.yml#L48 you use a manual_github_token as a workaround - could you please explain what the value should be?
Is it simply what you create via https://github.com/settings/tokens/new?
@loopmode Yes, that's what I did for now
Ah, I see, the version that fixes this issue is not marked as stable yet, which is why it's not in my project. Running yarn add --dev electron-builder@^22.0.0 to get the beta should fix this then.
The same issue here:
Error: GitHub Personal Access Token ("***") contains invalid characters, please check env "GH_TOKEN"
at new GitHubPublisher (D:\a\classroom.server\classroom.server\node_modules\electron-publish\src\gitHubPublisher.ts:53:15)
Most helpful comment
This is still happening with v21.2.0 (GitHub Actions on Ubuntu):