Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Missing input uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GH_TOKEN }} #187

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

Closed
zjt666666zjt opened this issue Nov 7, 2023 · 7 comments

Comments

@zjt666666zjt
Copy link

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 }} but when I act this GitHub action

##[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.

@ZPascal
Copy link
Collaborator

ZPascal commented Nov 7, 2023

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 }}

@zjt666666zjt
Copy link
Author

thanks for reply. I am a college stduent and I use it for the first time. I can confirm that I have added secrets.

@ZPascal
Copy link
Collaborator

ZPascal commented Nov 8, 2023

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.

@zjt666666zjt
Copy link
Author

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:
- cron: "0 1 * * *"
push:
branches: [ gh-pages ]
pull_request:
branches: [ gh-pages ]

jobs:
build:
runs-on: ubuntu-latest
steps:
# checkout
- 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

##[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

@ZPascal
Copy link
Collaborator

ZPascal commented Nov 9, 2023

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.

@zjt666666zjt
Copy link
Author

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.

@ZPascal
Copy link
Collaborator

ZPascal commented Nov 25, 2023

@zjt666666zjt You should follow the following steps to handle it on your side:

  1. Follow this link and set the GitHub Action workflow permissions to allow pushes to the repository
  2. Replace your GH Action push command inside your workflow file with the following code block and use the default token
- name: Push changes
  uses: ad-m/github-push-action@master
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
  1. Delete the custom token with the name GH_TOKEN inside the secrets section

I'll close this case now, feel free to reopen the case, if necessary.

@ZPascal ZPascal closed this as completed Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants