You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FilePusher is failing due to insufficient permissions to edit GitHub Actions workflow files #1410
This FilePusher run (internal link) is failing with a 404 error for the dotnet-docker main branch:
Microsoft.DotNet.VersionTools.Automation.GitHubApi.HttpFailureResponseException: Response code does not indicate success: 404 (NotFound) with content: {"message":"Not Found","documentation_url":"[https://docs.github.com/rest/git/refs#update-a-reference","status":"404"}](https://docs.github.com/rest/git/refs#update-a-reference%22,%22status%22:%22404%22})
at Microsoft.DotNet.VersionTools.Automation.GitHubApi.GitHubClient.EnsureSuccessfulAsync(HttpResponseMessage response) in /_/src/VersionTools/Microsoft.DotNet.VersionTools/Automation/GitHubApi/GitHubClient.cs:line 466
at Microsoft.DotNet.VersionTools.Automation.GitHubApi.GitHubClient.DeserializeSuccessfulAsync[T](HttpResponseMessage response) in /_/src/VersionTools/Microsoft.DotNet.VersionTools/Automation/GitHubApi/GitHubClient.cs:line 440
at Microsoft.DotNet.VersionTools.Automation.GitHubApi.GitHubClient.PatchReferenceAsync(GitHubProject project, String ref, String sha, Boolean force) in /_/src/VersionTools/Microsoft.DotNet.VersionTools/Automation/GitHubApi/GitHubClient.cs:line 405
at FilePusher.FilePusher.CreatePullRequestAsync(GitHubClient client, GitRepo gitRepo, Config config, Options options) in /file-pusher/FilePusher.cs:line 154
at FilePusher.FilePusher.<>c__DisplayClass2_1.<<PushFilesAsync>b__0>d.MoveNext() in /file-pusher/FilePusher.cs:line 61
This is preventing automated roll out of common infrastructure to the product repos.
What's interesting is that it was able to successfully create a PR for the nightly branch: dotnet/dotnet-docker#5827
changed the title [-]404 error from FilePusher [/-][+]FilePusher is failing due to insufficient permissions to edit GitHub Actions workflow files[/+]on Aug 29, 2024
The root cause of this issue was enabling GitHub Actions and adding the corresponding workflow files as part of dotnet/dotnet-docker#5316. GitHub workflow files are covered by a separate PAT scope than all other files in the repo. This error was inconsistent because not every PR submitted by the bot edits the actions workflow files.
Other notes:
Improper authentication to the GitHub API manifests as a 404 error in order to prevent bad actors from confirming the existence of private repos.
Fine-grained tokens give a better error message in this situation.
I resolved this by adding the "workflow" permission to the bot's PAT. There shouldn't be any other errors due to permissions errors editing workflow files, but it's possible that other permissions issues could show up as a 404 error in the future - in that case, open a separate issue instead of re-opening this one.
This error was inconsistent because not every PR submitted by the bot edits the actions workflow files.
FilePusher is only pushing files from the eng/common directory which doesn't have GH workflow files in it. So I'm confused how workflow permissions are involved here.
FilePusher is only pushing files from the eng/common directory which doesn't have GH workflow files in it. So I'm confused how workflow permissions are involved here.
You are right. Then I wonder which of the following this scope applies to:
It must be a combination of them. We've been pushing YML files this whole time w/o issue up to this point. So that in itself isn't the issue. Things went bad when actions were enabled.
Activity
mthalman commentedon Aug 27, 2024
This is failing for the nightly branch now too.
[-]404 error from FilePusher [/-][+]FilePusher is failing due to insufficient permissions to edit GitHub Actions workflow files[/+]lbussell commentedon Aug 29, 2024
The root cause of this issue was enabling GitHub Actions and adding the corresponding workflow files as part of dotnet/dotnet-docker#5316. GitHub workflow files are covered by a separate PAT scope than all other files in the repo. This error was inconsistent because not every PR submitted by the bot edits the actions workflow files.
Other notes:
I resolved this by adding the "workflow" permission to the bot's PAT. There shouldn't be any other errors due to permissions errors editing workflow files, but it's possible that other permissions issues could show up as a 404 error in the future - in that case, open a separate issue instead of re-opening this one.
mthalman commentedon Aug 29, 2024
FilePusher is only pushing files from the eng/common directory which doesn't have GH workflow files in it. So I'm confused how workflow permissions are involved here.
lbussell commentedon Aug 29, 2024
You are right. Then I wonder which of the following this scope applies to:
.yaml/.ymlfiles (seems most likely to me).workflowsfoldermthalman commentedon Aug 29, 2024
It must be a combination of them. We've been pushing YML files this whole time w/o issue up to this point. So that in itself isn't the issue. Things went bad when actions were enabled.