Closed zjt666666zjt closed 1 year ago
Could you please specify the GITHUB_TOKEN
as a used secret name or have you set a custom secret? FYI: I think the default variable GH_TOKEN
is only available inside the GH CLI.
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
thanks for reply. I am a college stduent and I use it for the first time. I can confirm that I have added secrets.
Hi @zjt666666zjt, I need a bit more context and information. Could you please share a screenshot of the secrets section of the repository, the expected case, the scope and rights of the custom token, and the workflow file?
Is the repository-scoped default token (GITHUB_TOKEN) not the best case for you? For this, it's also not necessary to define any GH token-related secrets.
_ok, my 'GITHUB_TOKEN' is from the 'Personal access tokens (classic)' in the setting. and in this repository . I have add a Dependabot secrets named 'GH_TOKEN' and put the'Personal access tokens (classic)'in to this secret_
name: Auto Update Bing Images CI
on: workflow_dispatch: schedule:
jobs: build: runs-on: ubuntu-latest steps:
- name: checkout
uses: actions/checkout@v2
# setup nodejs
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- run: node ./assets/js/bing.js
# commit
- name: commit file
run: |
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git config --local user.name 'github-actions[bot]'
git diff --exit-code || git add . && git commit -am '[bot] update images.json' --allow-empty
# push
- name: push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
this is my github action file . name is main.yml when it run the last step always notices me that the
Run ad-m/github-push-action@master
Push to branch main
Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}".
Error: Invalid exit code: 1
at ChildProcess.
A Dependabot secret is not available inside workflows. If you want to specify the custom token (PAT), it's necessary to add them to the Action section. For me, your case is still not clear. Do you want to push to the same repository or another repository? Is a branch protection rule active? Why it's necessary to use a PAT?
I recommend to try this corresponding settings out.
So what should I do to keep the workflow running. The is very important for me. I am not clearly what should I do. I am comfused.
@zjt666666zjt You should follow the following steps to handle it on your side:
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN
inside the secrets sectionI'll close this case now, feel free to reopen the case, if necessary.
commit
push
[debug]Evaluating condition for step: 'push changes'
[debug]Evaluating: success()
[debug]Evaluating success:
[debug]=> true
[debug]Result: true
[debug]Starting: push changes
[debug]Loading inputs
[debug]Evaluating: secrets.GH_TOKEN
[debug]Evaluating Index:
[debug]..Evaluating secrets:
[debug]..=> Object
[debug]..Evaluating String:
[debug]..=> 'GH_TOKEN'
[debug]=> null
[debug]Result: null
[debug]Evaluating: github.server_url
[debug]Evaluating Index:
[debug]..Evaluating github:
[debug]..=> Object
[debug]..Evaluating String:
[debug]..=> 'server_url'
[debug]=> 'https://github.com/'
[debug]Result: 'https://github.com/'
[debug]Loading env
Run ad-m/github-push-action@master Push to branch main Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}". Error: Invalid exit code: 1 at ChildProcess. (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:30:21)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
code: 1
}
[debug]Node Action run completed with exit code 255
[debug]Finishing: push changes##[debug]Evaluating condition for step: 'push changes'
[debug]Evaluating: success()
[debug]Evaluating success:
[debug]=> true
[debug]Result: true
[debug]Starting: push changes
[debug]Loading inputs
[debug]Evaluating: secrets.GH_TOKEN
[debug]Evaluating Index:
[debug]..Evaluating secrets:
[debug]..=> Object
[debug]..Evaluating String:
[debug]..=> 'GH_TOKEN'
[debug]=> null
[debug]Result: null
[debug]Evaluating: github.server_url
[debug]Evaluating Index:
[debug]..Evaluating github:
[debug]..=> Object
[debug]..Evaluating String:
[debug]..=> 'server_url'
[debug]=> 'https://github.com/'
[debug]Result: 'https://github.com/'
[debug]Loading env
Run ad-m/github-push-action@master Push to branch main Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}". Error: Invalid exit code: 1 at ChildProcess. (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:30:21)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1105:16)
at ChildProcess._handle.onexit (node:internal/child_process:305:5) {
code: 1
}
[debug]Node Action run completed with exit code 255
[debug]Finishing: push changes
I don’t know how to deal with it.