Update and pin remote actions
on this page
Fetch a remote action into the local cache, pin it in preflight.lock, move it to a newer revision, and make every controller resolve the same commit.
Prerequisites
- A playbook task that uses a remote action ref in
host/org/repo[/path/to/action]@revisionform (see Remote action refs) - HTTPS access to the Git host for the first fetch of each revision. The controller does not need a
gitbinary. - A shell in the project root, the directory containing
preflight.yml.preflight action fetchreads and writespreflight.lockin the current directory.
1. Reference a remote action
tasks:
- name: Apply signage configuration
uses: github.com/acme/actions/signage@v1
with:
display_name: lobby-01The part after @ is a tag, branch, or commit SHA. For how remote refs fit with stdlib and local actions, see Execution model.
2. Fetch and pin the action
preflight action fetch github.com/acme/actions/signage@v1Preflight prints the resolved commit for each ref. A fetch also follows remote uses: refs inside the action, so you may see several lines:
Fetched github.com/acme/actions/signage@v1 -> 0123456789abcdef0123456789abcdef01234567The action directory, including files next to action.yml, goes into the user cache:
~/.preflight/actions/github.com/acme/actions/signage@0123456789abcdef0123456789abcdef01234567/preflight.lock gains an entry keyed by the ref you fetched:
{
"actions": {
"github.com/acme/actions/signage@v1": {
"ref": "github.com/acme/actions/signage@v1",
"sha": "0123456789abcdef0123456789abcdef01234567",
"pinned": "github.com/acme/actions/signage@0123456789abcdef0123456789abcdef01234567"
}
}
}apply, check, and stage fetch any missing remote refs before they
run. validate and plan resolve only from the existing cache and
lockfile, and fail on a ref that has not been fetched.
3. Inspect the resolved action
preflight action info github.com/acme/actions/signage@v1The output lists the action’s name, version, description, author, inputs with required and default markers, and task names. It resolves through the same cache and lockfile as a playbook run.
4. Update a pinned ref
Once a ref is in preflight.lock, fetching the same ref again reuses the pinned commit without checking the remote.
To move to a new version:
-
Change the ref in the playbook, for example from
@v1to@v2. -
Fetch the new ref:
bashpreflight action fetch github.com/acme/actions/signage@v2Preflight adds a
@v2entry topreflight.lockand leaves the@v1entry in place.
To re-resolve a branch whose tip moved upstream:
-
Delete the ref’s key from the
actionsobject inpreflight.lock. -
Fetch the ref again:
bashpreflight action fetch github.com/acme/actions/signage@mainWith no lock entry to reuse, Preflight resolves the ref against the remote and writes a new entry.
5. Commit the lockfile
git add preflight.lock
git commit -m "Pin signage action to v2"Every controller that checks out this commit resolves the same pinned commit, fetching it once if its cache lacks it. Without a committed lockfile, two controllers fetching @main at different times can pin different commits.
Troubleshooting
| Error | Fix |
|---|---|
remote action "..." is not cached; run 'preflight action fetch ...' | The ref was never fetched on this controller, or ~/.preflight/actions was cleared. Run preflight action fetch <ref>. |
remote ref "..." must include @<revision> | action fetch accepts only Git-backed refs with @revision, not local (myorg/x) or stdlib (preflight/x) refs. |
remote ref "..." must start with a hostname | The first path segment needs a dot, as in github.com/acme/actions/signage@v1. |
git resolver: action "..." does not contain action.yml | The path/to/action part of the ref names a directory without action.yml. Check it against the repository layout. |
git resolver: fetch "...": ... | The repository or revision does not exist, or the controller cannot reach it over HTTPS. |
If the cache is cleared and you fetch a tag or branch again, Preflight
resolves that ref against the remote, not the SHA in preflight.lock.
If the tag or branch moved upstream, the new pin points to its current
commit.