I fixed a GitHub Actions pipeline once, in the shared workflow, and pushed. Two services picked the fix up on their next build. The third was still running the old pipeline a week later, every run green, no warning anywhere. It was the one I had pinned to a version tag, which is exactly what the documentation tells you to do. That gap, between "I fixed it" and "it is fixed everywhere", is what this post is about. Along the way: what a reusable workflow is and how it differs from a composite action, how a matrix behaves when one leg fails, why a cache saved on one branch is invisible to another, and the two errors that stop a shared workflow before its first step. Everything ran on real GitHub, in four private repositories, on the free minutes.
What is a reusable workflow?
A reusable workflow is a workflow file that declares on: workflow_call instead of on: push. Another workflow, in the same or a different repository, calls it as a job:
jobs:
build:
uses: my-org/shared/.github/workflows/build-image.yml@v1
with:
image-name: svc-a
The called file brings its own jobs, runners, matrix, permissions and outputs. The caller passes inputs and secrets and gets outputs back. It is a function at the job level.
A composite action is the other reuse mechanism, one level down: a folder with an action.yml whose runs.using is composite and whose steps run inside the caller's job, on the caller's runner. It is a function at the step level. The two are often confused because both start with uses:; the difference decides where you can use them, which I come back to in the trade-off table.
The problem, and why it matters
Every service repository starts with a copy of "the pipeline": check out, set up the language, test, build the image. The copy is identical on day one. Then one team bumps the Go version, another turns the cache off to debug something and forgets, a third comments out go vet during an incident and leaves a ticket number. Nobody decided to have three pipelines. Three pull requests did.
The cost shows up when something has to change everywhere at once. A security requirement says every image is scanned before it ships. That is one new step, and it is three pull requests, three reviews, three chances to get it slightly different, and then a fourth repository someone forgot. The people who own the pipeline are not the people who own the repositories, so the change waits.
The obvious fix is "put the pipeline in one place". GitHub gives you two ways to do that, and both work. The part nobody tells you is that once the pipeline lives in one place, every caller has to decide how tightly to follow it. That decision is where the week-old bug came from.
What a shared workflow gives you
| In practice | What changed in the lab | |
|---|---|---|
workflow_call with inputs |
one file, the differences between services become parameters | three services called the same build-image.yml with only image-name different |
outputs |
the called job hands values back | the image id came back to the caller |
| composite action | setup steps shared inside a job | Trivy install and tool versions in one action.yml, used by the reusable workflow |
| matrix from an input | the caller decides the versions, the shared file decides the shape | fromJSON(inputs.go-versions) ran three Go versions |
pinning (@main, @v1, @sha) |
each caller chooses how fast it follows | two callers on main got the fix, the one on v1 did not |
Dependabot github-actions |
pinned callers get a pull request when the shared file moves | a weekly schedule in the pinned service |
How it works: the callers and the edge

Two things about the model that are not obvious from the YAML:
- Checkout is the caller's. Inside the reusable workflow,
actions/checkoutchecks out the repository that called it, not the repository the workflow file lives in. That is what you want: the shared pipeline builds the service's code. It also means./.github/actions/somethinginside the reusable workflow looks in the caller's tree, so a composite action from the shared repository has to be referenced the long way,owner/shared/.github/actions/setup-tooling@ref. - The caller's permissions are the ceiling. A reusable workflow can ask for less than the caller grants, never more. If it asks for more, the run fails before any job starts, with the error in the "Where it broke" section.
The lab
Four private repositories: lab-gha-shared with the reusable workflows and the composite action, and lab-gha-svc-a, -b, -c, each a tiny Go HTTP service with a Dockerfile. Nothing deploys anywhere; the pipeline is the subject. Everything is driven from a laptop with the GitHub CLI, so the whole lab can be recreated in another account.
1. Three copies, one month later
The starting point is the copied pipeline in each service. I wrote the three files the way I have found them in real repositories, and diff says the rest.

All three runs are green. One of them has not run a test that could fail in weeks.
2. Moving to workflow_call, and the first wall
The shared repository gets build-image.yml: checkout, Go setup with cache, vet and test, build the image, hand back the image id. svc-a's workflow shrinks to five lines that call it with @main.
The first run fails before the first step. The shared repository is private, and a private repository's workflows are not callable from other repositories until you say so, under Settings → Actions → General → Access. The run page is the only place the message appears.

One setting later, svc-a and svc-b call the shared file at @main, svc-c calls it at @v1, a tag I cut on the same commit. Three green runs, three identical pipelines, and the drift from step 1 is gone.
3. One fix, two services
Now the change that started the post. The image has to be scanned before it ships, so the shared workflow gets two steps: the composite action that installs Trivy, and the scan itself. One commit on the shared main. Then a release commit in each service.


svc-a and svc-b scan. svc-c builds and ships exactly as before, green. There is no error, because nothing is wrong from svc-c's point of view: it asked for v1 and got v1. The pinned service is the safest one in the fleet and the one that will still be unscanned next quarter.
The lab added a detour I did not plan. My first version of the composite action installed Trivy with the upstream install script, pinned to a release that had been removed from GitHub in the meantime. svc-a and svc-b went red on the very commit that was supposed to improve them, while svc-c stayed green on v1. That is the other half of the same trade-off: the callers following main get every fix immediately, and every mistake.
The way out for a pinned caller is not "stop pinning". It is a pull request when the pin is stale. Dependabot's github-actions ecosystem covers uses: references to reusable workflows in other repositories, so svc-c gets a weekly PR that bumps @v1 to @v2, with the diff of the shared file one click away. Someone still has to merge it, and that is the point: the team that owns the service decides when the pipeline changes under them.
4. Matrix: one leg fails, what do you learn?
test-matrix.yml takes the Go versions as a JSON string and expands them with fromJSON into strategy.matrix. The caller passes three versions. The test suite has a switch that fails on exactly one of them.
With the default settings the run tells you one version is broken and nothing about the other two. fail-fast is on by default, so the moment one leg fails the others are cancelled, and cancelled is not passed.


The first version of this lab did not show the cancellation at all. All three legs ran the same slow test and finished at the same time, so the failing leg had nothing left to cancel. fail-fast only stops legs that are still running. In a real suite the broken leg usually fails early, at compile or at the first test, and the other legs are mid-way, so the cancellation is what you see. I made the broken leg fail at its first test to get the honest picture.
fail-fast: false costs the remaining minutes of the other legs and buys you the answer to "is it only 1.24?". For a pull request I want the answer. For a nightly build across ten versions I might not.
5. Cache: who can see what
actions/cache keyed on the Go module files. The log lines are the whole story:

feat-1 saved a cache. feat-2 could not see it. Both could see main's cache, once main had one. The rule is branch isolation: a workflow run can restore caches created on its own branch and on the base branch, not on sibling branches. The cache list at the end shows three entries with the same key, one per branch, and only the main one is useful to anyone else.
What that means in practice: a cache that is only ever warmed on feature branches is a cache that misses on every new branch. Warm it on main, with a scheduled run if main is quiet, and let restore-keys fall back to a partial match when the lock file changes.
6. Permissions and secrets across the call
The last reusable workflow, publish-image.yml, pushes to GitHub Container Registry, so its job asks for packages: write. The caller in svc-c grants contents: read and nothing else. The run does not start.

With packages: write granted, the job runs, and the first step prints the second lesson: the optional SCAN_TOKEN secret the reusable workflow declares arrives empty. Secrets do not cross the call unless the caller passes them one by one under secrets:, or writes secrets: inherit. Empty is not an error; the step that needs the token is the one that fails, somewhere later. With inherit, the same step reports the token present.
The first push to the registry was refused with a one-word denied, and the second run, with no change to the permissions, pushed fine. The package had been created and linked to the repository by the first attempt. I do not have a better explanation than that, so I am noting it rather than explaining it.
Limits and rules you only learn by hitting them
The YAML looks like any other workflow, so the rules that are specific to workflow_call tend to arrive as red runs. The ones I hit in this lab, or have hit in production, in the order they usually show up:
- A caller job that uses a reusable workflow cannot have steps. The job is the call. The keys you can put next to
usesarewith,secrets,needs,if,permissions,concurrencyandstrategy. Noruns-on, nosteps, noenvironmentat that level; the called workflow owns those. If you need "one step before the shared pipeline", that step is a separate job andneedschains them. - The runner is chosen by the called workflow. If callers need different runners, make the label an input (
runs-on: ${{ inputs.runner }}) with a sensible default. The same goes for the Go version, the image name, anything that varies. - Workflow-level
envin the caller does not reach the called workflow. Onlyinputsandsecretscross the boundary. Thegithubcontext inside the called workflow is the caller's:github.repository,github.sha,github.refall describe the service, which is why checkout works without being told what to check out. - Typed inputs exist in
workflow_calland not in composite actions. A reusable workflow input can bestring,numberorboolean, andfail-fast: ${{ inputs.fail-fast }}works because it is a real boolean. A composite action's inputs are strings;if: inputs.flag == 'true'is the idiom. - Secrets do not reach a composite action directly. There is no
secretscontext insideaction.yml; the caller passes the secret as an input, and GitHub still masks it in logs because the value is registered as a secret in the calling job. - Nesting is allowed, with a ceiling. A reusable workflow can call another one, up to four levels including the top caller, and a single run can reference a limited number of distinct reusable workflows. Deep chains also make the run page hard to read; two levels, pipeline and tooling, is where I stop.
- The same-repository short form skips the ref.
uses: ./.github/workflows/build.ymlcalls a workflow in the same repository at the same commit as the caller. No tag, nomain, no drift, and no way to share it with another repository. For a monorepo this is often all you need. fromJSONis the bridge for anything structured. Inputs are scalars, so a list of versions travels as a JSON string andfromJSON(inputs.go-versions)turns it back into a matrix. The same trick works for a map of environments.- Caches have a budget and an age. Each repository has a total cache size limit and entries that are not restored for a while are evicted, so a cache that only a monthly branch uses will not be there next month. Keys that include the lock file hash plus
restore-keysfor a partial match are the usual shape; the branch isolation rule from step 5 applies on top of that. - Minutes multiply. A three-leg matrix is three jobs; a reusable workflow called from thirty repositories is thirty jobs per change to the shared file if every caller rebuilds. Public repositories are free, private repositories spend the account's minutes.
fail-fastis a cost control as much as a signal;fail-fast: falseis a choice to pay for information.
Moving a fleet, not a lab
Three services is a lab. The same move with thirty repositories owned by six teams is a project, and the pipeline is the easy part. The order that has worked for me:
- Inventory first. Collect every
ci.yml, diff them against the newest one, and write down each difference with a reason. Most differences are accidents (step 1 of the lab); a few are real (a service that needs CGO, a repository that builds two images). The real ones become inputs; the accidents disappear. - One shared repository, owned.
platform/workflowsor similar, withCODEOWNERSpointing at the people who will answer when a caller goes red, branch protection onmain, and a release process: tags move only through a pull request, major tags (v1) follow the latestv1.x, the way the official actions do it. The Access setting is opened for the organisation, once. - Three callers before thirty. Migrate the services whose owners sit closest to you, on
@main, and leave them there for two weeks. These are the canaries; the shared workflow is tested by their pull requests before any tag moves. - Everyone else on a tag, with Dependabot. The migration PR to each repository is mechanical: delete the old file, add the five-line caller, add
dependabot.ymlwith thegithub-actionsecosystem if it is not already there. The teams merge it on their schedule. From then on a change to the shared workflow reaches them as a Dependabot PR with the diff attached, and the decision is theirs. - Rollback is a bump backwards. A bad
v2is undone in the caller by moving the pin tov1, not by reverting the shared repository under everyone. That asymmetry is the whole reason to pin. - Measure the one thing that matters. How long does a required change take to reach every repository? Before the move it was weeks and a spreadsheet; after, it is the slowest team's Dependabot merge. If that is still weeks, the problem is ownership, not YAML.
What this does not solve: repositories that genuinely have different pipelines. A reusable workflow with forty inputs and if on every step is three pipelines wearing one file. Two or three shared workflows, each honest about what it is for, beat one that tries to be everything.
Frequently asked
Can a reusable workflow call another reusable workflow? Yes, up to the nesting limit. The inner call is written the same way, as a job with uses. Permissions still flow down from the top caller.
Can I pass a secret to a composite action? Only as an input: with: token: ${{ secrets.MY_TOKEN }}. Inside the action it is inputs.token. The log masking survives because the value came from a secret in the calling job.
Why does ./.github/actions/foo fail inside my reusable workflow? Because the checkout in that job is the caller's repository, and the path is resolved against it. Reference the action as owner/shared-repo/.github/actions/foo@ref, and make sure the Access setting allows it.
Can the caller choose the runner? Not directly; runs-on belongs to the called workflow. Expose it as an input with a default.
Does secrets: inherit pass organisation secrets? It passes everything the caller's job could see, which includes repository, environment and organisation secrets the repository has access to. For a reusable workflow in another organisation it does not apply; in that case list the secrets explicitly.
How do I pin to a commit and still get updates? Pin to the full SHA and let Dependabot or Renovate open the PR; both understand SHA pins and add the version as a comment next to it so humans can read the diff.
Is workflow_call the same as workflow_dispatch? No. workflow_dispatch is a manual trigger with inputs from the UI or the API; workflow_call is a trigger from another workflow. A file can declare both, and the inputs can be shared, which is a tidy way to make the same pipeline runnable by hand.
Where it broke
1. workflow was not found
error parsing called workflow ".github/workflows/ci.yml" -> "owner/lab-gha-shared/.github/workflows/build-image.yml@main" : workflow was not found. The file existed. The shared repository was private and its Actions access was the default, "not accessible". Settings → Actions → General → Access → "Accessible from repositories owned by the user" (or the organisation). The same setting governs composite actions in that repository.
2. The nested job 'publish' is requesting 'packages: write', but is only allowed 'packages: none'
The caller's permissions block is the ceiling for every job the reusable workflow defines, and the check runs at parse time, before any job. Grant it in the caller or drop the request in the shared file; the shared file cannot escalate.
3. A pinned caller that never gets the fix
Not an error, which is the problem. @v1 is a promise that the file does not change under you, and it keeps that promise through every security fix. Dependabot github-actions plus a release process for the shared repository (tags that move only with a PR) is the minimum.
4. The shared fix that broke every @main caller
The composite action pinned a Trivy release that no longer existed; the install step failed on svc-a and svc-b at once. A shared workflow is a shared blast radius. Test it from one caller before the tag moves, and give main callers a reason to be main callers.
5. fail-fast cancelled the legs that would have passed
Default strategy.fail-fast: true. The run told me one version was broken and hid that the other two were fine. fail-fast: false where the answer matters.
6. Cache not found for input keys on a fresh branch
The key matched a cache that existed, on a sibling branch. Branch isolation: own branch and base branch only. Warm the cache on the default branch.
7. SCAN_TOKEN is empty
A secret declared required: false in the reusable workflow and not passed by the caller is simply empty. Declare it required: true if the job cannot work without it, so the run fails at the call instead of at the step.
The trade-off, side by side
How a caller references the shared workflow:
@main |
@v1 (tag) |
@<sha> |
|
|---|---|---|---|
| Plus | every fix lands on the next run, nothing to merge | stable until someone decides; a change is a visible PR | immutable; a moved tag cannot surprise you |
| Minus | every mistake lands too; a shared blast radius with no review in the caller | stale by default; the unscanned service was this one | unreadable in review; needs tooling to bump |
| Where it fits | a platform team that owns both sides and tests the shared repo before merging | service teams that own their release timing, with Dependabot or Renovate opening the bump | regulated pipelines, or when the shared repo is not yours |
Reusable workflow or composite action:
Reusable workflow (workflow_call) |
Composite action | |
|---|---|---|
| Scope | whole jobs: runner, matrix, environment, permissions, outputs | steps inside the caller's job, on the caller's runner |
| Plus | the caller is five lines; matrix and runners decided centrally | can be mixed with the caller's own steps; no job boundary, so files and tools carry over |
| Minus | no steps before or after inside the same job; nesting depth is limited; secrets need inherit or a list |
no matrix, no runner choice, no job-level permissions; secrets have to come in as inputs |
| Where it fits | "the pipeline" for a class of repositories | "the setup": install tools, log in, configure, used by many pipelines |
Neither column is the right answer. In the lab the pipeline is a reusable workflow, the tooling is a composite action the pipeline calls, and the services pin to a tag with Dependabot watching it. That is where I would start for a handful of services owned by different people; a single platform team owning everything can live on main.
When to use which
- Three copies of the same file is the signal. One copy is fine. Two is a coin flip.
- Reusable workflow for the pipeline, composite action for the parts of a job that repeat across pipelines.
- Open the Access setting before the first call from another repository; the error does not say "setting".
- Pin with a tag and automate the bump.
mainonly when the same people own both sides and test before merging. fail-fast: falseon pull requests where "which versions" matters; leave the default where the first failure is enough.- Warm the cache on the default branch. Feature branches do not share.
- Declare required secrets as required, and grant permissions in the caller on purpose, not by copying
write-all.
Your call
I pin the shared workflow to a tag and let Dependabot open the bump, and I keep the composite action for tooling only. That is for a fleet where the service teams and the pipeline team are different people; if you are both, main with a good test from one caller may be the simpler life. Two things I would like to hear from real repositories:
- Do your callers follow
main, a tag, or a commit, and who notices when the pinned one falls behind? - Who merges the pull request that bumps the shared workflow, the service team or the platform team?
I am not after who is right. I want the pluses and minuses of the columns above to be visible to everyone who reads this, in words from real pipelines, and the comments are where that happens: https://www.linkedin.com/in/mirac-can-yilmaz
Summary
- A reusable workflow is a job-level function (
on: workflow_call,uses:in the caller); a composite action is a step-level one inside the caller's job. Checkout in both is the caller's repository. - A private shared repository has to open Actions access before any other repository can call it; the error says
workflow was not found. - The caller's permissions are the ceiling; a nested job asking for more fails at parse time. Secrets do not cross the call without
secrets:orinherit. - Following
maingets every fix and every mistake at once; pinning a tag gets neither until someone bumps it. Dependabot'sgithub-actionsecosystem watches reusable workflow references. fail-fastcancels running legs; a cache is visible to its own branch and the base branch only.
Next in the series
This is post 8 of Core Skills. Previous: What Is Terragrunt? Next: What Is External Secrets Operator?, External Secrets Operator with AWS Secrets Manager on LocalStack, and what rotating a secret looks like from inside a pod.
The code for this lab (the shared workflows and composite action, the three services, the caller variants for each phase and the scripts that drive them with the GitHub CLI) is shared with Lab Access members on Buy Me a Coffee; the repo invite comes by email after you join: https://buymeacoffee.com/miraccanyilmaz/membership