Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/ACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ This guide describes the checked-in workflows. Follow each linked YAML file for

## Workflows

| Workflow | Events | Jobs |
| ---------------------------------------------------------------- | --------------------------- | ----------------- |
| [dependabot-auto-merge.yml](workflows/dependabot-auto-merge.yml) | `pull_request` | `dependabot` |
| [deploy-storybook.yml](workflows/deploy-storybook.yml) | `push`, `workflow_dispatch` | `build`, `deploy` |
| [lint.yml](workflows/lint.yml) | `push`, `pull_request` | `lint-and-build` |
| [storybook.yml](workflows/storybook.yml) | `push`, `pull_request` | `build` |
| Workflow | Events | Jobs |
| ------------------------------------------------------ | --------------------------- | ----------------- |
| [deploy-storybook.yml](workflows/deploy-storybook.yml) | `push`, `workflow_dispatch` | `build`, `deploy` |
| [lint.yml](workflows/lint.yml) | `push`, `pull_request` | `lint-and-build` |
| [storybook.yml](workflows/storybook.yml) | `push`, `pull_request` | `build` |

## Parallel steps

Expand All @@ -32,11 +31,12 @@ and release-proposal references use immutable commit pins with version comments.
| [actions/deploy-pages](https://github.com/actions/deploy-pages) | `v5.0.1` | `368f82528645a54fb793d4d04e342629a3f51346` |
| [actions/setup-node](https://github.com/actions/setup-node) | `v7.1.0` | `949feb2413d6458794dcd2491c4babbbce0c15c1` |
| [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) | `v5.0.0` | `fc324d3547104276b827a68afc52ff2a11cc49c9` |
| [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) | `v3.1.0` | `25dd0e34f4fe68f24cc83900b1fe3fe149efef98` |
| [oven-sh/setup-bun](https://github.com/oven-sh/setup-bun) | `v2.2.0` | `0c5077e51419868618aeaa5fe8019c62421857d6` |

## Greenkeeping

All dependency updates, including Dependabot patch and minor updates, require maintainer review and manual merging. Passing CI and a semver label do not establish that an upstream change is safe. There is no workflow that approves or merges dependency PRs: changes merged to `main` can publish the public Storybook.

[Dependabot configuration](dependabot.yml) checks GitHub Actions weekly and groups their updates. Review the upstream release notes, runtime requirements, permissions, and changes to inputs or artifact behavior before merging. Update SHA pins to the release commit, retaining the version comment where present.

1. Update every reference to the affected action, including local composite actions under `.github/actions/`.
Expand Down
33 changes: 0 additions & 33 deletions .github/workflows/dependabot-auto-merge.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ on:
branches: [main]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
# Build dependency code without deployment authority.
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
Expand Down Expand Up @@ -58,6 +56,9 @@ jobs:
path: ./storybook-static

deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
with:
node-version: 26.13.0

- name: Test workflow security policy
run: node --test scripts/check-workflow-security.mjs

- name: Test release metadata guard
run: node --test scripts/check-release-guard.mjs

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand Down
38 changes: 38 additions & 0 deletions scripts/check-workflow-security.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import assert from 'node:assert/strict'
import { readFileSync, readdirSync } from 'node:fs'
import test from 'node:test'

const directory = new URL('../.github/workflows/', import.meta.url)
const workflows = readdirSync(directory)
.filter((name) => /\.ya?ml$/.test(name))
.map((name) => [name, readFileSync(new URL(name, directory), 'utf8')])

test('dependency updates require manual review and merging', () => {
for (const [name, source] of workflows) {
assert.doesNotMatch(source, /gh\s+pr\s+(?:review|merge)\b/, name)
assert.doesNotMatch(
source,
/(?:auto-approve|enable-pull-request-automerge|merge-me|automerge-action)@/i,
name,
)
assert.doesNotMatch(source, /pull-requests:\s*write/, name)
}
})

test('PR build workflows explicitly use read-only tokens', () => {
const pullRequestWorkflows = workflows.filter(([, source]) => source.includes('pull_request:'))
for (const [name, source] of pullRequestWorkflows) {
assert.match(source, /^permissions:\n contents: read\n/m, name)
assert.doesNotMatch(source, /:\s*write\b|write-all|secrets\./, name)
}
})

test('only the isolated Pages deploy job has deployment authority', () => {
const source = readFileSync(new URL('deploy-storybook.yml', directory), 'utf8')
const [build, deploy] = source.split('\n deploy:\n')
assert.match(build, /^permissions:\n contents: read\n/m)
assert.doesNotMatch(build, /:\s*write\b|write-all/)
assert.match(deploy, /^ permissions:\n pages: write\n id-token: write\n/)
assert.doesNotMatch(deploy, /checkout@|bun (?:ci|install|run)|npm |pnpm /)
assert.match(deploy, /needs: build/)
})
Loading