# Update Pinned GitHub Actions in a Rust Repo

An agent pins every action in mdBook's four workflows to a full commit SHA with a version comment; actionlint, cargo build and cargo test all exit 0.

[Run this on Rush](https://cloud.getrush.ai/run/update-github-actions/rust/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent lists every `uses:` line in `.github/workflows`. `deploy.yml`, `publish-crates-io.yml` and `update-dependencies.yml` already pinned `actions/checkout` to `3d3c42e5…` with `# v7.0.1`, but `main.yml`, the CI file, still used `actions/checkout@v7`, `actions/setup-node@v7` and `crate-ci/typos@v1.50.3`, and `publish-crates-io.yml` pinned `rust-lang/crates-io-auth-action` at v1.0.5.

It reads each action's latest release from the GitHub API and resolves the tag to a commit. `crate-ci/typos` v1.51.1 is an annotated tag, so it pins the commit `7f9d0819…`, not the tag object `9023c1f7…`. No action moved a major version; the setup-node v7.1.0 notes leave `node-version: 24`, the only input mdBook passes, unaffected.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Update every action used in .github/workflows to its latest release, pinned by full commit SHA with the version as a trailing comment. Resolve each tag to its commit with the GitHub API, following annotated tags to the commit they point to. Read the release notes of any major-version jump for changed inputs and adjust the workflow. Validate every workflow with actionlint, run cargo build and cargo test, and open a pull request listing each action's old ref, new SHA and version, so its checks run the updated workflows.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on rust-lang/mdBook at 7fb5bc8e: 4 files changed, 16 insertions(+), 16 deletions(-) across `deploy.yml`, `main.yml`, `publish-crates-io.yml` and `update-dependencies.yml`. `checkout` is now one SHA in all 13 uses, `setup-node` moves to v7.1.0, `typos` to v1.51.1 and `crates-io-auth-action` from v1.0.5 to v1.0.6. `actionlint` printed nothing and exited 0, `cargo build` exited 0, and `cargo test` exited 0, ending `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s`.

For the reviewer: the edit also changed two-space `#` comments to one space, and `.github/renovate.json5` was not checked for whether it accepts SHA pins with `# vX.Y.Z` comments. The workflows did not run on GitHub, so `actionlint` is the only check on the YAML, and the typos and crates-io-auth-action notes were not read.

## Run it on every Monday morning

An automation with a `schedule` trigger, `cron` set to `0 9 * * 1` and the team's `timezone`, runs this prompt each Monday. Most weeks it will find what this trial found, minor and patch bumps; the week a major version lands, the prompt has it read that release's notes before touching inputs.

## Why run it on Rush?

Pinning looked done in mdBook: three workflows had SHA pins. The CI file every pull request runs still floated on tags, and one release tag was an annotated tag whose ref lookup returns the tag object's SHA, not the commit's. The run caught both and pinned the commit.

## Frequently asked questions

### Does this change Cargo dependencies or the MSRV?

No. The diff touches only the four workflow files. `cargo build` and `cargo test` ran to show the repository still builds; they do not read `.github`, so they say nothing about the workflows themselves.

### How were the SHAs looked up?

With unauthenticated GitHub API calls, because `gh` was not logged in: the latest release tag for each action, then the commit behind it. The tags were not checked for signatures.

## More Rust jobs

- [Upgrade Rust Dependencies Every Week](https://getrush.ai/run/upgrade-dependencies-weekly/rust/)
- [Write Property-Based Tests for a Rust Crate](https://getrush.ai/run/write-property-tests/rust/)
- [Write Unit Tests for a Rust Project](https://getrush.ai/run/write-unit-tests/rust/)

## The same job on other stacks

- [Update the GitHub Actions in a Rust CLI's Workflows](https://getrush.ai/run/update-github-actions/rust-cli/)
- [Update Pinned GitHub Actions in a Tauri Repo](https://getrush.ai/run/update-github-actions/tauri/)
- [Update the GitHub Actions in a tRPC Project's CI](https://getrush.ai/run/update-github-actions/trpc/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
