GitHub Workflow Updater
A VS Code extension that automatically pins GitHub Actions to specific commits for enhanced security.
An OWASP project that helps secure GitHub Actions workflows by pinning actions to immutable commit hashes.
Features
- Automatic Pinning: Updates GitHub Actions to use commit hashes instead of version tags
- Latest Version Detection: Finds the highest semantic version and pins to its commit
- Private Repository Support: Configure GitHub token for private repositories
- Skip Pinning: Use
# skip-pinning comment to exclude specific actions
- Comprehensive Updates: Updates entire workflow file at once
- Error Handling: Continues processing other actions if one fails
Actions lockfile support (experimental)
- Update Actions Lockfile — regenerate
.github/workflows/actions.lock (the
format of GitHub's gh actions-lock CLI,
schema v0.0.3) from workflows found recursively under the selected repository
root, including deeply nested subdirectories, resolving every uses: ref against
GitHub and recording commit digests, symbolic refs, and owner/repository IDs.
Valid YAML without workflow jobs: is treated as non-workflow content
- Verify Actions Lockfile — offline coverage check (no token), or with a
token: also verify every recorded commit still matches its ref and flag moved
tags, mismatched digests, and repository transfers
Installation
VSCode
Run the following in the edit prompt (ctrl+shift+p)
ext install OWASP.Github-Workflow-Updater-Extension
Cursor
Click cursor:extension/OWASP.Github-Workflow-Updater-Extension
Note: The extension is listed as OWASP GitHub Workflow Updater on the VS Code Marketplace to distinguish it from the previous publication.
Available from the following registries
Open VSX Registry
Visual Studio Code Marketplace
Usage
Update a single workflow file
- Open a GitHub workflow file (
.yml or .yaml)
- Click the sync button in the editor toolbar, or right-click the file in the Explorer and select Update GitHub Workflow Actions
- The extension will update all actions in that file to their latest pinned versions
Update all workflows in the current folder
- Open the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P)
- Run
GitHub Workflow Updater: Update All Workflows in Current Folder
- The extension recursively scans all
.yml and .yaml files at any depth under the directory of the currently active file (or the selected folder), updates any actions that need pinning, and saves the changed files
You can also right-click any folder in the Explorer and select Update All Workflows in Current Folder.
Every YAML descendant is inspected, but valid YAML documents without workflow jobs:—such
as composite action.yml manifests, Dependabot/actionlint configuration, and unrelated
configuration—are skipped rather than reported as invalid workflows. YAML syntax errors are
still reported per file. Package-manager dependency trees and VCS control directories are
excluded from discovery because their workflows use a different repository root. Workflow
templates with unresolved action-reference placeholders are left unchanged rather than being
sent to GitHub as though they were deployable references; such templates are also omitted
from lockfile generation.
Note: The command processes every workflow file and continues if one fails. A summary notification shows how many actions were updated, skipped, or errored.
Configuration
Set your GitHub Personal Access Token in VS Code settings:
GitHub Workflow Updater: Github Token
This token is required for accessing private repositories and helps avoid rate limits.
Actions Lockfile (Experimental)
The extension can maintain the same lockfile GitHub's gh actions-lock
CLI produces, so GitHub's server-side pin verification can resolve your workflow actions
to exact commits even when your uses: lines name tags or branches.
Commands:
GitHub Workflow Updater: Update Actions Lockfile — regenerate .github/workflows/actions.lock
from all workflows in the current workspace. Each repository action becomes a dependency
entry keyed OWNER/REPO@<ref> with:
commit: the algo-prefixed digest (sha1-…) of the ref the workflow uses
owner_id / repo_id: numeric GitHub IDs (used to detect repository transfers)
ref: the symbolic ref (tag or branch) a pinned commit was found under, via reverse lookup
GitHub Workflow Updater: Verify Actions Lockfile — without a token: offline lockfile
coverage (every repo action in your workflows has a pin entry). With a token: additionally
checks each recorded commit against the ref's current position on GitHub and flags moved
tags, mismatched digests, and transferred repositories.
Workflow integration: with github-workflow-updater.lockfilesEnabled and
github-workflow-updater.updateLockfileWithWorkflows enabled (both default true),
Update All Workflows in Current Folder automatically creates or refreshes the lockfile
after every completed scan that inspected at least one valid workflow — even when all pins
were already current. Single-file updates create or refresh it after changing a workflow.
Cancellation, an empty scan, or a scan containing only non-workflow YAML does not create one;
a lockfile failure never breaks the update.
Local ./ composites are expanded per workflow: the extension reads each local
action.yml/action.yaml (including nested local composites, with cycle detection and the
depth cap) and adds every reachable remote action to that calling workflow's own pin list.
A dependency already present elsewhere in the lockfile does not cover a caller that omits it.
Missing manifests block generation with an actionable error. A local path beneath an
actions/checkout with.path prefix is remapped only when that checkout is provably the
same repository (an omitted repository, ${{ github.repository }}, or a literal match to
the workspace origin). External or ambiguous checkouts remain errors rather than guessing.
Local-action diagnostics: generation errors include the repo-relative workflow path.
For full lookup details, open View → Output → GitHub Workflow Updater: Lockfiles (or
Open Logs on a generation failure). Each unresolved entry names the workflow, local
reference, available same-repository checkout prefixes, and every attempted action.yml /
action.yaml path; successful checkout-prefix remaps are logged too.
Remote composite actions are followed transitively: every pinned action's action.yml is
fetched at the pinned commit, nested remote uses: become lockfile entries with
per-entry uses: edges. The walk is capped by
github-workflow-updater.lockfileMaxDepth (default 10, the upstream runner's limit);
a chain that exceeds it aborts the update with an explicit error — never a silent
partial lockfile — naming the setting and the unexpanded actions. Raise the setting
if your action graph is legitimately deeper. Reusable workflow calls are pinned at
OWNER/REPO@REF — a deliberate divergence from upstream actions-lockfile issue #179 so
generated files pass the offline coverage check. A SHA that is neither a tag commit nor
a branch head is recorded with its own SHA as ref; the extension warns about those
(GitHub's backend rejects such entries — re-pin through the updater or use a tag ref).
Byte compatibility: generated lockfiles are byte-identical to gh actions-lock
output (validated against lockfiles committed by real CLI users).
Disabling the lockfile integration (backwards compatibility)
The lockfile commands are opt-in, and with the settings below the extension can be
restored to exactly its pre-lockfile behavior. Organizations that do not want the
feature at all can turn it off entirely:
"github-workflow-updater.lockfilesEnabled": false
With the setting disabled, both commands decline with a message and the lockfile
is never touched — including automatic creation or refresh after workflow updates. The
setting defaults to true.
To keep the commands but stop automatic lockfile creation/refresh after workflow updates:
"github-workflow-updater.updateLockfileWithWorkflows": false
Related knob: github-workflow-updater.lockfileMaxDepth (number, default 10) —
see the composite-action note above.
Lockfile engine
The engine is the published npm package
@gh-action-lock-ts/gh-action-lock-ts
(MIT) — a native TypeScript port of github/actions-lockfile format semantics
and gh-actions-lock resolve semantics, published from
RichardoC/gh-action-lock-ts
via OIDC trusted publishing with provenance. No shelling out to gh/git.
Skip Pinning
To prevent an action from being updated, add a # skip-pinning comment:
- uses: actions/checkout@main # skip-pinning
Example
Before:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3.5.1
After:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
Requirements
- VS Code 1.97.0 or higher
- Internet connection for GitHub API access
Security
This extension enhances security by:
- Pinning actions to specific commits prevents supply chain attacks
- Immutable references ensure consistent behavior
- Following security best practices from StepSecurity
Development
Building the Extension
Install dependencies:
npm install
Bundle for production (used by vsce package automatically):
npm run bundle
Or, for development with live reloading:
npm run watch
The extension uses rollup for bundling: all source files and dependencies are combined into a single out/extension.js. TypeScript compilation (npm run compile) is still used by the test suite, which imports the individual compiled modules.
Testing the Extension
Open in your editor: Open this project folder in VS Code or Cursor
Launch Extension Development Host:
- Press
F5 or use the "Run and Debug" panel
- Select "Run Extension" configuration
- This opens a new window with the extension loaded (VS Code window if using VS Code, Cursor window if using Cursor)
Test the functionality:
- In the Extension Development Host window, open a GitHub workflow file (
.yml or .yaml)
- Click the sync button in the editor toolbar
- The extension should update actions to pinned versions
Refresh the Extension Development Host:
After making code changes, you need to refresh the Extension Development Host:
- Method 1: Use Command Palette (
Cmd+Shift+P on Mac, Ctrl+Shift+P on Windows/Linux)
- Type "Developer: Reload Window" and select it
- Method 2: Close and reopen the Extension Development Host window (press
F5 again)
- Method 3: Use the restart button in the Debug toolbar
- Note: In Cursor on macOS, the Extension Development Host works the same as VS Code
Running Tests
npm test
The test suite is offline by design:
- it uses Node's built-in test runner, so no extra test framework is required
- it reads the local
test-workflow.yml fixture and uses mocked update metadata
- it does not call the GitHub API, which keeps tests deterministic and avoids leaking tokens or depending on network access
Packaging for Distribution
npx vsce package
Or use the provided npm script:
npm run package
This creates a .vsix file that can be installed in VS Code or Cursor. The vsce package command automatically runs the rollup bundler (via the vscode:prepublish script), so no separate build step is needed.
Installation
From VS Code Marketplace
ext install OWASP.Github-Workflow-Updater-Extension
Manual Installation
Download or build the extension:
- Either download a
.vsix file from releases
- Or build it yourself following the Development section above
Install the .vsix file:
- Open VS Code or Cursor
- Press
Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)
- Type "Extensions: Install from VSIX..."
- Select the
.vsix file
- Restart your editor
Configure GitHub token (optional but recommended):
- Go to Settings (Code → Preferences → Settings)
- Search for "GitHub Workflow Updater"
- Set your GitHub Personal Access Token
GitHub Token Scopes
For Classic Personal Access Tokens, you need:
public_repo - Access public repositories
repo - Full access to private repositories (if you need private repo access)
For Fine-grained Personal Access Tokens, you need:
- Repository permissions:
Contents: Read - Read repository files and metadata
Metadata: Read - Read repository metadata (required)
Actions: Read - Read workflow files (if accessing Actions)
Note: Fine-grained tokens must be configured for each organization/repository you want to access.
Troubleshooting
404 Not Found Errors
If you see errors like:
Failed to update tesslio/github-workflows/.github/workflows/production-deploy.yml: Error: GitHub API error: 404 - {"message":"Not Found"}
This typically means:
Reusable workflows: For reusable workflows like owner/repo/.github/workflows/workflow.yml@ref, the extension now correctly extracts just the repository name (owner/repo) for API calls while preserving the full path in updates.
Sub-actions: For GitHub Actions with sub-actions like actions/cache/restore@ref or actions/cache/save@ref, the extension now correctly extracts the base repository name (actions/cache) for API calls while preserving the full sub-action path in updates.
Private repository access: If the repository is private, ensure your token has access:
- For fine-grained tokens: Add the repository to your token's repository access list
- For classic tokens: Use the
repo scope instead of public_repo
Organization permissions: For organization repositories with fine-grained tokens, the organization must approve your token
Repository name format: Ensure actions use the correct format: owner/repo@version (not file paths)