3 ms·
One cool undocumented GitHub Actions trick I spotted at work was the ability to use wildcards to match repository_dispatch event names: on: repositor
by digianarchist 2y ago
One cool undocumented GitHub Actions trick I spotted at work was the ability to use wildcards to match repository_dispatch event names:
on:
repository_dispatch:
- security_scan
- security_scan::*
Why would you want to do this?
We centralize our release pipelines as it's the only way to force repositories through a defined reusable workflow (we don't want our product teams to have to maintain them).
This allows us to dispatch an event like so:
{
"event_type": "security_scan::$product_name::$version",
"client_payload": {
"field": "value"
}
}
Then it is far easier to identify which product and version a workflow is running when looking in the Actions tab of our central release repository.
- larusso 2y agoNice trick!
- c0wb0yc0d3r 2y agoHow have you found this centralized approach to work for you? Does your org require everything be built in exactly the same way? I’ve just joined an organization that is trying to do similar, but in practice it seems nearly worthless. Templates are frequently broken, or written in ways that expect code to be built in a particular manner without any supporting docs describing the requirements.
- digianarchist 2y agoWe centralize releases but we don't centralize builds. That would remove too much autonomy from teams. We don't use templates for any of this. Our interface is the payload sent with repository_dispatch, a few metadata files in the repository (which we fetch) and a GitHub application that allows us to update the PRs with the release status checks. GitHub doesn't have a great story here, ideally we would want to listen to CI events emitting from a repo and run workflows as a reaction. The reusable story on a modular basis is better but here we're missing features that we would need to move some of workflows into Actions. Notably - Action repos need to be public.
- connorgurney 2y agoOnly to use the actions within on public repositories. https://docs.github.com/en/actions/sharing-automations/sharing-actions-and-workflows-from-your-private-repository https://docs.github.com/en/actions/sharing-automations/shari...
- digianarchist 2y agoTo clarify my previous comment. Actions cannot be private for public repositories. Most of our repos are public.