Repository navigation
ci: approval-gated fast path on Blacksmith runners #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # Fast path: check and package agent-trajectories on Blacksmith runners, | ||
| # outside the shared GitHub-hosted queue. Anyone with write access (people or | ||
| # agents) may start it; nothing runs until Khaliq approves the fast-path | ||
| # environment. | ||
| # | ||
| # It runs the same checks as ci.yml (lint, typecheck, build + tests on Node 20 | ||
| # and 22, CLI smoke), then packs the package at <version>-fast.<sha7> (g<sha7> if the | ||
| # short SHA is all digits) and | ||
| # uploads the tarball as a workflow artifact. It does not publish to npm: the | ||
| # package uses npm trusted publishing (OIDC) bound to publish.yml, so only that | ||
| # workflow can publish. It never moves a dist-tag, commits, tags or creates a | ||
| # release. | ||
| name: fast-path | ||
| run-name: fast-path ${{ inputs.ref }} (${{ inputs.reason }}) | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: Branch, tag or commit to check (a PR branch is fine) | ||
| required: true | ||
| default: main | ||
| reason: | ||
| description: Why this needs the fast path | ||
| required: true | ||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: fast-path-${{ inputs.ref }} | ||
| cancel-in-progress: false | ||
| env: | ||
| NPM_CONFIG_FUND: false | ||
| jobs: | ||
| check: | ||
| environment: fast-path | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| outputs: | ||
| sha: ${{ steps.sha.outputs.sha }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
| - id: sha | ||
| run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npm run lint | ||
| - run: npm run typecheck | ||
| - run: npm run build | ||
| - name: Verify CLI is executable | ||
| run: | | ||
| node dist/cli/index.js --version | ||
| node dist/cli/index.js --help | ||
| # Some tests spawn the built CLI, so they run after the build. | ||
| - run: npm run test:run | ||
|
|
||
| test-node22: | ||
| needs: check | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ needs.check.outputs.sha }} | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22" | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npm run build | ||
| - run: npm run test:run | ||
|
|
||
| pack: | ||
| needs: [check, test-node22] | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ needs.check.outputs.sha }} | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22.14.0" | ||
| cache: npm | ||
| - run: npm ci | ||
| - name: Set the fast version | ||
| id: version | ||
| env: | ||
| SHA: ${{ needs.check.outputs.sha }} | ||
| run: | | ||
| base=$(node -p "require('./package.json').version") | ||
| # A numeric prerelease identifier must not start with 0, so an | ||
| # all-digit short SHA gets a "g" prefix to stay valid SemVer. | ||
| id="${SHA:0:7}" | ||
| if [[ "$id" =~ ^[0-9]+$ ]]; then id="g$id"; fi | ||
| version="${base%%-*}-fast.$id" | ||
| npm version "$version" --no-git-tag-version --allow-same-version | ||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
| - run: npm run build | ||
| - name: Pack | ||
| run: | | ||
| mkdir -p fast-tarballs | ||
| npm pack --ignore-scripts --pack-destination fast-tarballs | ||
| ls -l fast-tarballs | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: trajectories-npm-fast-${{ needs.check.outputs.sha }} | ||
| path: fast-tarballs/*.tgz | ||
| if-no-files-found: error | ||
| - name: Summary | ||
| env: | ||
| REF: ${{ inputs.ref }} | ||
| SHA: ${{ needs.check.outputs.sha }} | ||
| REASON: ${{ inputs.reason }} | ||
| VERSION: ${{ steps.version.outputs.version }} | ||
| run: | | ||
| { | ||
| echo "### trajectories fast path" | ||
| echo "- ref: \`$REF\` at \`$SHA\`" | ||
| echo "- reason: $REASON" | ||
| echo "- version: \`agent-trajectories@$VERSION\` (not published; npm uses trusted publishing via publish.yml)" | ||
| echo "- artifact: \`trajectories-npm-fast-$SHA\`" | ||
| for f in fast-tarballs/*.tgz; do echo " - \`$(basename "$f")\`"; done | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disable admin bypass on the
fast-pathenvironment.The
fast-pathenvironment requires approval fromkhaliqgant. Itscan_admins_bypasssetting istrue, so any repository admin can run the gated jobs without that approval. The approval gate is intended to hold for every dispatch.Turn off "Allow administrators to bypass configured protection rules" for the
fast-pathenvironment. This is a repository setting, so no workflow change is needed. After the change, re-check the environment withcan_admins_bypassset tofalse.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declining: the environment is set up per the rollout spec (Khaliq as the required reviewer). The admin-bypass setting is a repo policy choice for Khaliq, not something this PR should change.