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
12 changes: 9 additions & 3 deletions .github/workflows/actions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,17 @@ workflows:
'.github/workflows/rust-ci-reusable.yml':
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
- 'dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772'
- 'goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406'
- 'swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6'
'.github/workflows/scorecard-enforcer.yml':
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
- 'actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c'
- 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a'
- 'ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc'
'.github/workflows/scorecard-reusable.yml':
- 'github/codeql-action@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28'
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
- 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a'
- 'github/codeql-action@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28'
- 'ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc'
'.github/workflows/secret-scanner-reusable.yml':
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
Expand Down Expand Up @@ -177,7 +178,7 @@ dependencies:
owner_id: 42048915
repo_id: 356423100
'dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772':
ref: 'v1'
ref: '6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772'
commit: 'sha1-6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772'
owner_id: 1940490
repo_id: 260749683
Expand All @@ -196,6 +197,11 @@ dependencies:
commit: 'sha1-db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28'
owner_id: 9919
repo_id: 259445878
'goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406':
ref: 'v2.2.1'
commit: 'sha1-abea47f85e598557f500fa1fd2ab7464fcb39406'
owner_id: 1006268
repo_id: 212984112
'haskell-actions/setup@6037f33647c3f17758a2356c80fc4a53d7e0685d':
ref: 'v2.12.0'
commit: 'sha1-6037f33647c3f17758a2356c80fc4a53d7e0685d'
Expand All @@ -217,7 +223,7 @@ dependencies:
owner_id: 18365890
repo_id: 220359305
'swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6':
ref: 'v2.9.2'
ref: '6323deb102c322ba6fcbdcafc7e3dddab59af2b6'
commit: 'sha1-6323deb102c322ba6fcbdcafc7e3dddab59af2b6'
owner_id: 580492
repo_id: 298565987
Expand Down
57 changes: 52 additions & 5 deletions .github/workflows/allowlist-preflight-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:

jobs:
preflight:
name: Actions policy (tree + live)
name: Actions policy (tree)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand All @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
ref: main
ref: ${{ job.workflow_sha }}
path: .standards-checkout
sparse-checkout: |
rhodium-standard-repositories/actions-allowlist
Expand All @@ -56,9 +56,56 @@ jobs:
bash "$RUNNER_TEMP/check-allowed-actions.sh" \
"$RUNNER_TEMP/allowed-actions.json" .github/workflows

live-policy:
name: Live Actions policy (credentialed advisory)
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout policy source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
ref: ${{ job.workflow_sha }}
path: .standards-checkout
sparse-checkout: |
rhodium-standard-repositories/actions-allowlist
scripts/check-actions-policy.sh
sparse-checkout-cone-mode: false

- name: Report unavailable live policy credential
env:
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }}
if: ${{ env.GH_TOKEN == '' }}
run: |
echo "::notice::Live Actions policy was not evaluated: HYPATIA_SCAN_PAT was not supplied by the caller. The separate tree allowlist gate still ran."
# shellcheck disable=SC2016
printf '%s\n' \
'### Live Actions policy not evaluated' \
'' \
'The caller did not supply `HYPATIA_SCAN_PAT`. This advisory job' \
'does not claim that the repository Administration setting passed.' \
'The independent tree allowlist preflight remains enforced.' \
>> "$GITHUB_STEP_SUMMARY"

- name: Check live repository policy
env:
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT || github.token }}
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }}
if: ${{ env.GH_TOKEN != '' }}
run: |
bash "$RUNNER_TEMP/check-actions-policy.sh" \
"$GITHUB_REPOSITORY" "$RUNNER_TEMP/allowed-actions.json"
set +e
bash .standards-checkout/scripts/check-actions-policy.sh \
"$GITHUB_REPOSITORY" \
.standards-checkout/rhodium-standard-repositories/actions-allowlist/allowed-actions.json
rc=$?
set -e
if [ "$rc" -eq 3 ]; then
echo "::notice::Live Actions policy was not evaluated: the supplied credential could not read the Administration endpoint."
printf '%s\n' \
'### Live Actions policy not evaluated' \
'' \
'A credential was supplied, but the Administration API was unavailable.' \
'No live-policy pass is claimed; rotate or re-authorise the credential.' \
>> "$GITHUB_STEP_SUMMARY"
exit 0
fi
exit "$rc"
96 changes: 77 additions & 19 deletions .github/workflows/governance-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ jobs:
echo "has_baseline=false" >> $GITHUB_OUTPUT
fi

- name: Clone standards repository
run: |
# Treeless partial clone: full commit graph (needed by the staleness
# gate's ancestry / commits-behind / age math) without paying for
# every tree+blob in history. Falls back to a deep clone if the
# server rejects the partial-clone filter.
git clone --filter=tree:0 https://github.com/hyperpolymath/standards.git "$HOME/standards" \
|| git clone --depth 200 https://github.com/hyperpolymath/standards.git "$HOME/standards"
- name: Checkout pinned standards history
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
# The gate needs the full graph for ancestry and age checks, but its
# script must come from the exact reusable commit rather than moving
# main. This also lets a Standards PR test its own validator change.
ref: ${{ job.workflow_sha }}
path: .standards-history
fetch-depth: 0
filter: tree:0
persist-credentials: false

- name: Run staleness check
env:
Expand All @@ -60,8 +64,9 @@ jobs:
# past this commit: the script comes from standards HEAD, but the job
# definition comes from whatever SHA the consumer pins.
GITHUB_TOKEN: ${{ github.token }}
STALENESS_STANDARDS_DIR: ${{ github.workspace }}/.standards-history
run: |
bash "$HOME/standards/scripts/check-workflow-staleness.sh" .
bash .standards-history/scripts/check-workflow-staleness.sh .

allowlist-preflight:
name: Allowlist Preflight
Expand All @@ -80,7 +85,9 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
ref: main
# Exact commit of this reusable workflow. This preserves consumer
# pin semantics and lets a standards PR test its own scripts.
ref: ${{ job.workflow_sha }}
path: .standards-checkout
sparse-checkout: |
rhodium-standard-repositories/actions-allowlist
Expand All @@ -103,17 +110,66 @@ jobs:
fi
bash "$RUNNER_TEMP/check-allowed-actions.sh" \
"$RUNNER_TEMP/allowed-actions.json" .github/workflows
rm -rf .standards-checkout

actions-policy-live:
name: Live Actions policy (credentialed advisory)
runs-on: ${{ inputs.runs-on }}
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Checkout standards for the live policy gate
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
ref: ${{ job.workflow_sha }}
path: .standards-checkout
sparse-checkout: |
rhodium-standard-repositories/actions-allowlist
scripts/check-actions-policy.sh
sparse-checkout-cone-mode: false

- name: Report unavailable live policy credential
env:
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }}
if: ${{ env.GH_TOKEN == '' }}
run: |
echo "::notice::Live Actions policy was not evaluated: HYPATIA_SCAN_PAT was not supplied by the caller. The separate tree allowlist gate still ran."
# shellcheck disable=SC2016
printf '%s\n' \
'### Live Actions policy not evaluated' \
'' \
'The caller did not supply `HYPATIA_SCAN_PAT`. This advisory job' \
'does not claim that the repository Administration setting passed.' \
'The independent tree allowlist preflight remains enforced.' \
>> "$GITHUB_STEP_SUMMARY"

- name: Check live Actions policy
env:
# GitHub's job token cannot read this Administration endpoint. Keep
# this dependency explicit: missing/expired credentials must make the
# live control red rather than silently reducing it to a tree check.
# The ordinary job token cannot read the repository Administration
# endpoint. When a caller deliberately supplies this credential, an
# API/authentication failure or real policy violation remains red.
GH_TOKEN: ${{ secrets.HYPATIA_SCAN_PAT }}
if: ${{ env.GH_TOKEN != '' }}
run: |
rm -rf .standards-checkout
bash "$RUNNER_TEMP/check-actions-policy.sh" \
"$GITHUB_REPOSITORY" "$RUNNER_TEMP/allowed-actions.json"
set +e
bash .standards-checkout/scripts/check-actions-policy.sh \
"$GITHUB_REPOSITORY" \
.standards-checkout/rhodium-standard-repositories/actions-allowlist/allowed-actions.json
rc=$?
set -e
if [ "$rc" -eq 3 ]; then
echo "::notice::Live Actions policy was not evaluated: the supplied credential could not read the Administration endpoint."
printf '%s\n' \
'### Live Actions policy not evaluated' \
'' \
'A credential was supplied, but the Administration API was unavailable.' \
'No live-policy pass is claimed; rotate or re-authorise the credential.' \
>> "$GITHUB_STEP_SUMMARY"
exit 0
fi
exit "$rc"

validate-hypatia-baseline:
name: Validate Hypatia Baseline
Expand Down Expand Up @@ -188,14 +244,16 @@ jobs:

# A reusable workflow only auto-checks-out its own YAML, not sibling
# scripts. Sparse-check-out standards' scripts/ to get apply-baseline.sh,
# mirroring the language-policy job below. Pinned to main because
# github.workflow_sha resolves to the *caller* repo's SHA (which would 404).
# mirroring the language-policy job below. `job.workflow_sha` is the exact
# commit of this called workflow, so the filter and schema semantics cannot
# drift from the reusable workflow that invoked them. This also lets a
# standards PR test its own script change instead of silently using main.
- name: Check out standards for the baseline filter
if: needs.workflow-staleness.outputs.has_baseline == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: hyperpolymath/standards
ref: main
ref: ${{ job.workflow_sha }}
path: .standards-checkout
sparse-checkout: |
scripts
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/label-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ permissions:
jobs:
triage:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Classify and label
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ permissions:
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Apply canonical labels
env:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/rust-ci-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# with:
# enable_audit: true
# enable_coverage: true
# zig_version: "0.15.2" # for Rust crates with a Zig-native build
#
# Sub-crate / monorepo workspace (Cargo.toml lives in a subdirectory):
#
Expand Down Expand Up @@ -101,6 +102,14 @@ on:
type: string
required: false
default: "."
zig_version:
description: |
Exact Zig version required by a Rust crate's native build. Leave
empty for pure-Rust workspaces. When set, check, test, and coverage
jobs install the same compiler before invoking Cargo.
type: string
required: false
default: ""

# Only `contents: read` is requested. A reusable workflow may narrow the
# caller's permissions but never widen them: requesting a permission the
Expand Down Expand Up @@ -171,6 +180,12 @@ jobs:
toolchain: stable
components: clippy, rustfmt

- name: Install Zig for native build
if: ${{ inputs.zig_version != '' }}
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
with:
version: ${{ inputs.zig_version }}

- name: Cache cargo registry and build
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
with:
Expand Down Expand Up @@ -213,6 +228,12 @@ jobs:
with:
toolchain: stable

- name: Install Zig for native build
if: ${{ inputs.zig_version != '' }}
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
with:
version: ${{ inputs.zig_version }}

- name: Cache cargo registry and build
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
with:
Expand Down Expand Up @@ -293,6 +314,12 @@ jobs:
toolchain: stable
components: llvm-tools-preview

- name: Install Zig for native build
if: ${{ inputs.zig_version != '' }}
uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
with:
version: ${{ inputs.zig_version }}

- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --locked

Expand Down
Loading
Loading