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
18 changes: 17 additions & 1 deletion .github/workflows/audit-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,35 @@ concurrency:
jobs:
audit-on-pr:
name: Audit on pull request
# Disabled by default while the self-hosted audit runner is unavailable.
# Set the repository variable AUDIT_AUTO_ENABLED=true to restore automatic audits.
if: github.event_name == 'pull_request'
runs-on: [self-hosted, Linux, ARM64, audit-linux]
runs-on: ${{ fromJSON(vars.AUDIT_AUTO_ENABLED == 'true' && github.event.pull_request.head.repo.full_name == github.repository && '["self-hosted","Linux","ARM64","audit-linux"]' || '["ubuntu-latest"]') }}
env:
AUTO_AUDIT_ENABLED: ${{ vars.AUDIT_AUTO_ENABLED == 'true' && github.event.pull_request.head.repo.full_name == github.repository }}

steps:
- name: Automatic audit disabled
if: env.AUTO_AUDIT_ENABLED != 'true'
run: echo "Automatic audit is disabled"

- name: Checkout PR head
if: env.AUTO_AUDIT_ENABLED == 'true'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false

- name: Check required tools
if: env.AUTO_AUDIT_ENABLED == 'true'
run: |
which git
which jq
which python3

- name: Create source archive
if: env.AUTO_AUDIT_ENABLED == 'true'
id: archive
shell: bash
run: |
Expand Down Expand Up @@ -88,6 +99,7 @@ jobs:
echo "archive_name=${ARCHIVE_NAME}" >> "$GITHUB_OUTPUT"

- name: Submit audit job
if: env.AUTO_AUDIT_ENABLED == 'true'
id: submit
shell: bash
run: |
Expand All @@ -110,6 +122,7 @@ jobs:
echo "report_url=$REPORT_URL" >> "$GITHUB_OUTPUT"

- name: Poll report until ready
if: env.AUTO_AUDIT_ENABLED == 'true'
id: poll
shell: bash
run: |
Expand Down Expand Up @@ -137,6 +150,7 @@ jobs:
exit 1

- name: Fetch markdown report
if: env.AUTO_AUDIT_ENABLED == 'true'
shell: bash
run: |
REPORT_PATH="${{ steps.submit.outputs.report_url }}"
Expand All @@ -152,6 +166,7 @@ jobs:
fi

- name: Normalize markdown for GitHub comment
if: env.AUTO_AUDIT_ENABLED == 'true'
shell: bash
run: |
python3 <<'PY'
Expand All @@ -169,6 +184,7 @@ jobs:
PY

- name: Comment markdown report to PR
if: env.AUTO_AUDIT_ENABLED == 'true'
uses: actions/github-script@v7
with:
script: |
Expand Down
12 changes: 12 additions & 0 deletions BRANCHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,15 @@ Retain the hotfix branch until both merges are complete.
| `hotfix/*` | `develop` | Hotfix back-merge |

The `source-and-target` workflow enforces these routes.

## Audit workflow

Automatic pull-request Audit is disabled by default while the self-hosted
runner is unavailable. Leave the repository variable `AUDIT_AUTO_ENABLED`
unset, or set it to a value other than `true`, to keep the Audit check as a
successful no-op on GitHub-hosted infrastructure.

Set `AUDIT_AUTO_ENABLED=true` only after the runner is healthy. Automatic Audit
then runs only for branches in this repository; fork pull requests remain on
the no-op path. Authorized users listed in `AUDIT_ALLOWED_USERS` can continue
to request the existing self-hosted workflow with `/audit-pr`.
Loading