首页 > 解决方案 > 使用 GitHub Actions 推送存储库时出错:接收 403

问题描述

我正在尝试使用 GitHub 操作执行下面的代码,在推送存储库时得到 403。这里似乎没有任何文档有帮助。请帮助我知道我是否遗漏了什么。

name: Env Variables
on: push

env:
  WF_ENV: Available to all jobs

jobs:
  create_issue:
    runs-on: ubuntu-latest
    permissions:
      issues: write
    steps:
      - name: Update pre requisites
        run: |
            sudo apt-get -y install git
      - name: Checkout the repo
        uses: actions/checkout@v2
      - name: Push a random file
        run: |
          set -xe
          pwd
          ls -a
          git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          ls -a
          echo $RANDOM >> random.txt
          ls -a
          git add .
          git commit -m "[ACTIONS GITHUB]:Added a Random file"
          git remote set-url --add --push origin "https://$GITHUB_ACTOR:$token@github.com/$GITHUB_REPOSITORY.git"
      - name: Push the changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: ${{ github.ref }}

标签: githubgithub-actions

解决方案


推荐阅读