Skip to main content
In this lesson you’ll create a reusable GitHub Actions workflow in a dedicated organizational repo and invoke it from an application repository. This centralizes common CI steps (for example, dependency installation) so multiple repositories can reuse the same logic. Prerequisites
  • An organization (in this example: game-devstudio)
  • Two repositories:
    • game-devstudio/.github — an organization repository that stores settings and reusable workflows
    • game-devstudio/ghas-guardrail-demo — a sample Node.js application that will call the reusable workflow
Quick reference

1) Create the reusable workflow

Add a workflow file to the .github repository at game-devstudio/.github/.github/workflows/reusable-ci.yml:
What this does:
  • on: workflow_call exposes this workflow so other workflows can call it.
  • Declares a required input node-version so callers can choose the Node.js version.
  • The npm-install job checks out the code, configures Node.js to the requested version, and runs npm install on an Ubuntu runner.
Commit this file to the main branch of game-devstudio/.github.
Reusable workflows are invoked using the uses: <owner>/<repo>/<path>@<ref> syntax. Any inputs declared under workflow_call must be supplied by the caller. See the GitHub Docs for reusing workflows: https://docs.github.com/actions/learn-github-actions/reusing-workflows

2) Call the reusable workflow from another repo

In the application repository (game-devstudio/ghas-guardrail-demo) create a workflow at game-devstudio/ghas-guardrail-demo/.github/workflows/ci.yml that references the reusable workflow:
Notes:
  • The uses value includes:
    • owner: game-devstudio
    • repository: .github
    • path: .github/workflows/reusable-ci.yml
    • ref: @main
  • workflow_dispatch enables manual runs from the Actions UI for testing.
Commit this file to main in game-devstudio/ghas-guardrail-demo. The caller workflow will run on push or can be triggered manually via the Actions tab.
A dark-themed screenshot of the GitHub Actions page for a repository (ghas-guardrail-demo), showing the left sidebar with workflow and management options. The main pane lists recent workflow runs with branch badges and status indicators (failure, in progress, success).

3) Troubleshooting: “workflow was not found”

If the run fails with an error like this:
the most common cause is an access restriction: the caller repository does not have permission to use the reusable workflow. By default you can restrict which repositories can call workflows stored in another repository. How to resolve
  1. Open the repository that contains the reusable workflow (game-devstudio/.github).
  2. Go to Settings → Actions → General.
  3. Under the access control options, allow the appropriate repositories to call workflows from this repository — for example choose “Accessible from repositories in this organization” if you want organization repositories to call it.
  4. Save changes and re-run the caller workflow (push or use workflow_dispatch).
A dark-themed screenshot of a GitHub repository's Settings > Actions page showing options like "Artifact and log retention," "Fork pull request workflows," and workflow permissions with the repository settings sidebar on the left. Browser tabs and window controls are visible along the top.
If the reusable-workflow repository is private, only repositories with explicit access (or those allowed by organization settings) can call it. Check both the Actions access control and repository visibility before retrying.

4) Repository visibility considerations

If access is still blocked, verify the visibility and access of the calling repository. In this demo, the caller needed to be private to match the access policy. To change visibility (if necessary), go to the calling repo’s Settings → Danger Zone and follow the prompts to make the repository private. Be sure to review the consequences before changing visibility.
A dark-themed GitHub repository settings page with a confirmation modal to make the repo "game-devstudio/ghas-guardrail-demo" private, showing a red "Make this repository private" button. The background displays Issues settings and Danger Zone actions like change visibility, transfer, archive, and delete.
After updating access or visibility, re-run the caller workflow either by pushing a commit or via the Actions UI (workflow_dispatch).

5) Successful run — what to expect

When the caller has permission, the run will expand to show the jobs and steps defined in the reusable workflow. You will see the job name (npm-install) and each step execute on the runner. Example log snippets:

Summary — key points

  • Create reusable workflows with on: workflow_call and declare any inputs (for example node-version).
  • Call them from other repositories with uses: <owner>/<repo>/<path>@<ref> and supply required with inputs.
  • Ensure the repository containing the reusable workflow allows access for the caller via Settings → Actions → General.
  • Repository visibility matters: a private reusable-workflow repo requires appropriate access settings for callers.
This pattern centralizes standard CI steps into reusable workflows so you can maintain consistency across many repositories. Links and references

Watch Video