2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub Actions 上で .github/workflows 上のファイルを git push すると remote rejected エラー

Posted at

エラー内容

! [remote rejected] main -> main (refusing to allow a GitHub App to create or update workflow `.github/workflows/foo.bar` without `workflows` permission)

問題のコード

GitHubActions内で
  git config --local user.email $GHA_EMAIL
  git config --local user.name $GHA_NAME
  git add .github/workflows/foo.bar
  git commit -m 'Update'
  git push

やったこと

Workflow Permission の変更

Read and write にする

image.png

PAT の権限変更 (Workflow)

そもそも Actions 内では secrets.GITHUB_TOKEN を利用しているので意味ない気もするが、念のため。

image.png

.github/workflows 内に Push しないようにする

ここが盲点だった。
純粋にリポジトリルートに Push させるようにしたらエラーが出なくなり、Push に成功した。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?