Skip to content
Open
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
3 changes: 3 additions & 0 deletions .changeset/happy-lands-sink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

---
17 changes: 17 additions & 0 deletions .github/workflows/pr-bundle-size-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@ jobs:
with:
node-version: '22'

- name: Find bundle-size artifact
id: artifact
env:
GH_TOKEN: ${{ github.token }}
SOURCE_RUN_ID: ${{ github.event.workflow_run.id }}
shell: bash
run: |
set -euo pipefail
found=$(gh api --paginate --slurp "repos/$GITHUB_REPOSITORY/actions/runs/$SOURCE_RUN_ID/artifacts?per_page=100" --jq '[.[].artifacts[]] | any(.name == "bundle-size-analysis" and .expired == false)')
echo "found=$found" >> "$GITHUB_OUTPUT"
if [[ "$found" != "true" ]]; then
echo "No bundle-size artifact for this attempt; report-only verification runs do not rebuild bundles." >> "$GITHUB_STEP_SUMMARY"
fi

- name: Download bundle-size report
if: steps.artifact.outputs.found == 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: bundle-size-analysis
Expand All @@ -41,9 +56,11 @@ jobs:
run-id: ${{ github.event.workflow_run.id }}

- name: Validate downloaded bundle size report
if: steps.artifact.outputs.found == 'true'
run: node apps/bundle-size/scripts/validate-report.mts bundle-size-analysis/report.md

- name: Publish bundle size PR comment
if: steps.artifact.outputs.found == 'true'
env:
EXPECTED_HEAD_REPOSITORY: ${{ github.event.workflow_run.head_repository.full_name }}
EXPECTED_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/pr-control-assessment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Control Assessment PR Summary

on:
workflow_run:
workflows: [PR]
types: [completed]

permissions:
actions: read
contents: read
pull-requests: read

concurrency:
group: control-assessment-${{ github.event.workflow_run.head_repository.id }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: false

jobs:
publish:
name: Publish trusted Checkbox assessment
if: ${{ github.event.workflow_run.event == 'pull_request' && vars.CONTROL_ASSESSMENT_PUBLISH == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout trusted publisher
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 0
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'

- name: Find source assessment
id: artifact
env:
GITHUB_TOKEN: ${{ github.token }}
run: node scripts/src/tasks/controlAssessmentCiTask.ts find-artifact

- name: Download source assessment data
if: steps.artifact.outputs.found == 'true'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ steps.artifact.outputs.artifact-name }}
path: ${{ runner.temp }}/checkbox-source-evidence
github-token: ${{ github.token }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}

- name: Validate publication without write credentials
id: prepare
if: steps.artifact.outputs.found == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
BUNDLE_PATH: ${{ runner.temp }}/checkbox-source-evidence/bundle.json
run: node scripts/src/tasks/controlAssessmentCiTask.ts prepare-publication

- name: Create narrowly scoped publisher token
id: app-token
if: steps.prepare.outputs.eligible == 'true'
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3
with:
client-id: ${{ vars.CONTROL_ASSESSMENT_APP_CLIENT_ID }}
private-key: ${{ secrets.CONTROL_ASSESSMENT_APP_PRIVATE_KEY }}
permission-contents: write

- name: Commit the generated summary and SPEC assessment fields to the PR branch
if: steps.prepare.outputs.eligible == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
ASSESSMENT_WRITE_TOKEN: ${{ steps.app-token.outputs.token }}
BUNDLE_PATH: ${{ runner.temp }}/checkbox-source-evidence/bundle.json
run: node scripts/src/tasks/controlAssessmentCiTask.ts publish
Loading
Loading