Repository navigation
🔧 Add a GitHub App manifest with the needed privileges - #59
Conversation
| checks: write | ||
|
|
||
| # The deployed App additionally has `Single file` (`.github/patchback.yml`) | ||
| # read access, but a manifest cannot declare which file that would be, and |
There was a problem hiding this comment.
Why? It should be okay to hardcode this for now.
| # backport label landing on an already merged PR, and a labeled PR being | ||
| # merged. | ||
| default_events: | ||
| - pull_request |
There was a problem hiding this comment.
I prefer zero-indent sequences in my YAML:
| - pull_request | |
| - pull_request |
If you'd like, here's an idea for another PR (or a few, for linters): https://github.com/tox-dev/tox-pre-commit/blob/32376c4/.pre-commit-config.yaml / https://github.com/tox-dev/tox-pre-commit/blob/32376c4/.yamllint
|
|
||
| # GitHub App names are globally unique and `patchback` is taken by the public | ||
| # instance, so a private one has to pick its own name at registration time: | ||
| # name: patchback-myorg |
There was a problem hiding this comment.
Technically, this app isn't currently set up to actively support multiple deployments, so I wouldn't care about having this hardcoded with the actual main app ID for now:
| # name: patchback-myorg | |
| name: patchback |
This manifest isn't used by anything anyway. Eventually, I hope, octomachinery could implement the same manifest flow as Probot. Then, we could think of whether this need to change, but not now. Now, I just wanted to have something structured in one place and this pre-existing format seemed like a good fit.
|
Done — On your linter note: the repo is on pre-commit.ci but has no config, which is what the red |
| checks: write | ||
|
|
||
| # Reading `.github/patchback.yml`. Which file that is gets configured in | ||
| # the App's settings, not in the manifest. |
There was a problem hiding this comment.
@LuShadowX does the manifest not have a place for listing the actual file paths? I think that modern GH App creation UI even allows listing several files IIRC.
|
You're right about the UI — it does take several paths now, and the API reflects that: an installation object carries The manifest is the gap. The documented parameter set is only these twelve keys — So One gap while I'm in here: |
Lists the events and repository permissions Patchback needs, so a private instance can be registered from the manifest instead of the privileges being reconstructed from the code.
Address review: the App does not support multiple deployments, so the name is set to `patchback` instead of being left commented out, and the private-instance framing is dropped. Sequences are unindented, and the `single_file` permission is declared rather than explained away.
Add the explicit document start/end markers the other YAML in this repo uses, and drop the `* ` bullets from the Refs comment so the two long URLs count as non-breakable words.
Thanks for digging into this! I'm okay with having a comment if there's nothing else to be done.
I've checked the actual app entity, and it does have this privilege requested. I vaguely recall getting a Sentry alert related to it when GH introduced privilege separation for the workflows folder and adding it. Here's the screenshot: So I think the manifest should also have this privilege requested with an explanatory comment. It's pretty common to backport CI/infra/GHA stuff, I'd even say that it's important to keep it in sync across a set of supported/stable branches for an extended period of time so that any backports that happen to touch those files apply w/o conflicts, especially if they are security fixes or things involved in the process of cutting releases from the LTS branches. |
The deployed App has it, and pushing a commit that touches `.github/workflows/` needs it in addition to `Contents: write`.
|
Added in Screenshot matches the file now, except
|
| # including unlocking and re-locking it when it was locked. | ||
| pull_requests: write | ||
|
|
||
| # Publishing the `Backport to <target branch>` check run that mirrors the |
There was a problem hiding this comment.
Also creating a check suite (which is an implementation detail I suppose so probably doesn't really matter if it's mentioned here explicitly).
webknjaz
left a comment
There was a problem hiding this comment.
Alright, I think this is ready to go in. Thanks!
I know that agentic tools are eager to game the system and run the underlying tooling directly but only do this if you really know what you're doing. The contributors are always expected to use the project's main workflow tool configured. In many Python projects it's tox that is internally configured to run other things properly with correct configurations (like invoking pytest/pre-commit/etc), in some it'd be nox/uv/make or something like that. In some, you'll see several layers, and you can go for something in the middle (pre-commit/prek). But in general, unless you're running something the contrib file says you to run or the CI is configured to run, it wouldn't be considered supported and you may end up in a situation that in behaves in a way that is unexpected and wouldn't even know it. |
|
Thanks for the merge, and for spelling out the tooling expectation — that's a fair hit. Now that the pre-commit config is in, I'll report what |

The permission manifest you asked for in #57 (comment), as its own PR.
Everything in it is derived from the code rather than from the settings page, and it lines up with the list you posted in #10:
pull_requestis the only event with handlers (closedandlabeledinevent_handlers.py);contents: write— the clone and thegit pushof the backport branch, plus reading.github/patchback.yml;pull_requests: write— creating the backport PR, and the comment/lock calls on the original one;checks: write— theBackport to <branch>check run.Two things I left as comments instead of values: the webhook URL, which is per-deployment, and
Single file, since a manifest can't say which file andcontentsalready covers it.nameis commented out too because App names are globally unique.Refs: #10