Ability to add custom metadata to pull requests #27939
Replies: 7 comments 10 replies
|
Now that I think about it, maybe I could output my metadata to a json file, then use https://github.com/actions/cache to store it in the repository cache to then fetch it later when running pull request checks? It's a shame there's no built in way, but I suppose that'd work?' Are there any better ways? |
|
I recall seeing an action a while back that added hidden |
|
Found this thread looking for a similar solution on issues. |
|
I am about to do this using git notes, was just searching for an example, but alas found none. and then when I need to read it |
How? I wasn't able to find anything about this in the GitHub API docs. |
|
i'm tempted to consider this: https://cli.github.com/manual/gh_variable_set which is equivalent to leveraging secrets/variable as storage. it's not ideal either since there's a hard limit of 1k variables and that you need a PAT with specific permissions (Variables: write) |
|
As far as I know, there still is not a native “custom metadata fields on a pull request” feature in GitHub itself. The practical choices are mostly about how persistent and queryable you need the data to be:
Use artifacts, not cache. Cache is an optimization layer and can disappear. Artifacts are tied to workflow runs and are more predictable, but they are still not really PR metadata.
Use a hidden marker in the PR body or in a bot-authored comment. It is not elegant, but it is common because PRs are issues internally and comments/bodies are easy to read/update through the API. Example marker: <!-- pr-metadata:{"imageDigest":"sha256:...","templateChanged":true} -->If you do this, make the automation own a clearly named block so it can update only that block and leave the human-written description alone.
Use labels, commit statuses, check runs, or PR comments. For example, a check run can expose structured output in its summary, and labels can represent coarse metadata like
Use an external store keyed by I would avoid using Actions cache or repository variables as the main metadata store. Cache is not durable enough, and repository variables are global, limited, and awkward for per-PR state. For your use case, I would probably use one of these two patterns:
A native PR metadata API would definitely be cleaner, but until that exists, the bot-owned hidden block is usually the simplest durable GitHub-native workaround. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Is there any way to add custom information to pull requests? I'm setting up a ✨ fancy ✨CI system using github actions in my gitops repository, however I was wondering if there was any way we could add custom metadata to a PR?
For example, some PRs may or may not be trying to modify a kubernetes template, specifying an image digest to use. If the PR is indeed modifying an image digest/tag, I want to run certain tests, using stuff like the image digest, etc.
Now that's easy enough when creating the pull requests, as I have access to information about the code changes, in my case, when I create them from another action.
However, based on my understanding, there is no way to save any of that information for later. I can only control the following things:
I've seen some hacky solutions, like using html comments to hide invisible metadata in PR bodies, however that feels like a really really janky solution, and not ideal
Is there any way around this? I feel this would be a great new feature, and would enable developers to make some pretty nifty intergrations without requiring a separate database to store this information
All reactions