{{ message }}
[gh repo sync] Make missing workflow regexp aware of GitHub App#10574
Merged
jtmcg merged 2 commits intoMar 12, 2025
Merged
Conversation
jtmcg
reviewed
Mar 10, 2025
Contributor
Follow up of cli#7612 The `missingWorkflowScopeRE` is defined to capture the error message when the `GH_TOKEN` does not have `workflow` scope in `gh repo sync <remote>`, but this is only intended for error messages for OAuth Apps and does not work with GitHub Apps. In GitHub App, you will get the following error: ``` { "message": "refusing to allow a GitHub App to create or update workflow `.github/workflows/teamcity-pr-checks.yml` without `workflows` permission", "documentation_url": "https://docs.github.com/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository", "status": "422" } ``` As you can see above, the existing regexp does not match the "`workflows` permission". This change modifies the regexp to return the user-friendly error message when the `workflow` permission is missing, even in the case of a GitHub App.
88e0452 to
b012886
Compare
jtmcg
approved these changes
Mar 12, 2025
jtmcg
left a comment
Contributor
There was a problem hiding this comment.
Boy, this ended up being a doozy to test, but with the wizardry of @andyfeller we managed to validate this change in a workflow 🥳
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Mar 26, 2025
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [cli/cli](https://github.com/cli/cli) | minor | `v2.68.1` -> `v2.69.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>cli/cli (cli/cli)</summary> ### [`v2.69.0`](https://github.com/cli/cli/releases/tag/v2.69.0): GitHub CLI 2.69.0 [Compare Source](cli/cli@v2.68.1...v2.69.0) #### What's Changed ##### Features - Commands that accept filepath arguments will do glob expansion for `*` characters, by [@​iamazeem](https://github.com/iamazeem) in cli/cli#10413 ##### Bug Fixes - `gh issue/pr comment --edit-last` no longer creates a comment in non-interactive mode if there weren't one. A new flag `--create-if-none` provides this behaviour, by [@​andyfeller](https://github.com/andyfeller) in cli/cli#10625 - `gh repo sync` provides a more informative error for missing workflow permissions when the token is provided by a GitHub app, by [@​wata727](https://github.com/wata727) in cli/cli#10574 - `gh api` no longer tries to encode URLs incorrectly, by [@​williammartin](https://github.com/williammartin) in cli/cli#10630 ##### Other - Add cli-discuss-automation environment to triage.md by [@​jtmcg](https://github.com/jtmcg) in cli/cli#10552 - chore: remove redundant word in comment by [@​kevincatty](https://github.com/kevincatty) in cli/cli#10586 - Bump golang.org/x/net from 0.34.0 to 0.36.0 by [@​dependabot](https://github.com/dependabot) in cli/cli#10593 #### New Contributors - [@​kevincatty](https://github.com/kevincatty) made their first contribution in cli/cli#10586 - [@​wata727](https://github.com/wata727) made their first contribution in cli/cli#10574 **Full Changelog**: cli/cli@v2.68.1...v2.69.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMTMuNSIsInVwZGF0ZWRJblZlciI6IjM5LjIxMy41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #10573
Follow up of #7612
The
missingWorkflowScopeREis defined to capture the error message when theGH_TOKENdoes not haveworkflowscope ingh repo sync <remote>, but this is only intended for error messages for OAuth Apps and does not work with GitHub Apps.In GitHub App, you will get the following error:
As you can see above, the existing regexp does not match the "
workflowspermission".This change modifies the regexp to return the user-friendly error message when the
workflowpermission is missing, even in the case of a GitHub App.