<p>各位 v 友好,我最近在学习 github actions, 但是不清楚为啥会在自动 push 的时候报错~ 就是 push 到当前 repo 的 main 分支的时候报错了 我也搜索了相关的 issue ,但是还是没法解决: <a href="https://github.com/ad-m/github-push-action/issues/96" rel="nofollow">https://github.com/ad-m/github-push-action/issues/96</a></p>
<p>特来求助各位呜呜呜</p>
<p>我的报错信息是:</p>
<pre><code>Push to branch main
remote: Permission to ... denied to github-actions[bot].
fatal: unable to access '...': The requested URL returned error: 403
Error: Invalid exit code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:29:21)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
code: 128
}
Error: Invalid exit code: 128
at ChildProcess.<anonymous> (/home/runner/work/_actions/ad-m/github-push-action/master/start.js:29:21)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1022:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
</code></pre>
<p>配置文件如下:</p>
<pre><code class="language-yml">name: learn
env:
PYTHON_VERSION: '3.8' # set this to the Python version to use
on:
issues:
types:
- labeled
jobs:
learning:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7c1f14191f171309083c0a4e">[email protected]</a>
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
...
- name: Commit files
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Add changes" -a
- name: Push changes
uses: ad-m/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="492e203d213c2b64393c3a2164282a3d2026270924283a3d2c3b">[email protected]</a>
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
</code></pre>
@ 您刚才说的应该是 PAT ?我看到文档里面写到:At the start of each workflow run, GitHub automatically creates a unique GITHUB_TOKEN secret to use in your workflow. You can use the GITHUB_TOKEN to authenticate in a workflow run.
我想问问这不是自动创建的吗?