【发布时间】:2020-09-04 11:25:58
【问题描述】:
我创建了一个 GitHub 操作,用于创建新版本并将其发布到我们的 JS 存储库。看起来和这个很像
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.18.3
registry-url: https://npm.pkg.github.com/
scope: '<redacted>'
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Bump Version & Push
run: |
git config --local user.email "<redacted>"
git config --local user.name "<redacted>"
npm version patch
git push https://${{ secrets.KEY }}@github.com/<redacted> HEAD:master --follow-tags
我使用的 KEY 是我从我的帐户创建的个人访问令牌。我已经设置了 repo,以便我可以推送到 master 分支。当我使用访问令牌从我的机器尝试推送命令时,它可以正常工作。但是每次我在 GitHub Action 中看到这个
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: You're not authorized to push to this branch. Visit https://docs.github.com/articles/about-protected-branches/ for more information.
我一直在绞尽脑汁试图弄清楚这一点,并且我正在提出想法。如果我删除分支保护,此操作可以正常工作。
【问题讨论】:
标签: github-actions