Repository navigation
Description
Problem
Forks of this repository inherit its scheduled workflows. A fork has none of the organisation's credentials, so those runs fail and send failure noise. For example, the fork modeseven-lfreleng-actions/.github ran the zizmor publisher on schedule today, and discovery stopped because ZIZMOR_SARIF_PAT is unset:
Error: No token available: the calling workflow must pass a PAT via the 'token' secret
Manual (workflow_dispatch) runs in a fork are useful for testing workflow changes before they land, but nothing stops them posting to the organisation's real Slack channel (#releng-scm) if Slack credentials are present. A test run in a fork, or in any repository other than this one under lfreleng-actions, must never reach that channel.
Required behaviour
The owner check uses github.repository_owner: the account the workflow runs under. Do not use inputs.org, because a dispatch from a fork can pass org: lfreleng-actions to scan this organisation, and that must still count as a fork run.
- Schedules run only under
lfreleng-actions. Whengithub.event_name == 'schedule'andgithub.repository_owner != 'lfreleng-actions', every job in the workflow is skipped. The run must finish as skipped or successful, never as failed, and must not start a runner job that needs secrets. - Manual dispatch keeps working everywhere.
workflow_dispatch(and the non-schedule triggers that exist today) must behave as now in a fork, so changes can be debugged there. - Slack posts only under
lfreleng-actions, whatever the trigger. Whengithub.repository_owner != 'lfreleng-actions', noslackapi/slack-github-actionstep may run. This covers dispatch runs, includingallow-list-dns-check.yaml'stest_notificationinput. Where the job does other useful work (step summary, digest, report), skip only the Slack step and say so in the step summary or a::notice::, as the existing "Check Slack configuration" steps do for missing credentials. Where a job does nothing but post to Slack (thenotify-failurejobs), gate the whole job. - No change in
lfreleng-actions. Scheduled runs, Slack digests and failure alerts in this repository behave exactly as now.
Workflows in scope
Every workflow on main with a schedule: trigger, plus every Slack step:
| Workflow | Schedule | Slack |
|---|---|---|
.github/workflows/aislop-sarif-publish.yaml |
daily 07:00 | notify-failure job |
.github/workflows/zizmor-sarif-publish.yaml |
weekdays 06:00 | notify-failure job |
.github/workflows/allow-list-bump.yaml |
Monday 05:00 | notify (digest step) and notify-failure job |
.github/workflows/allow-list-dns-check.yaml |
daily 04:30 | "Send Slack notification" step in the notify job |
.github/workflows/repo-audit.yaml |
Monday 10:00 | "Send Slack notification (updates needed)" step |
.github/workflows/openssf-scorecard.yaml |
Sunday 04:50 | none (gate the schedule only; leave push, branch_protection_rule and workflow_dispatch alone) |
repo-discovery.yaml is a reusable workflow with no schedule. Its callers gate it, so it needs no change.
Traps to avoid
GitHub runs a job whose if: calls always() even when the job it depends on was skipped. Gating only the first job therefore leaves these jobs running in a fork:
aislop-sarif-publish.yamlaggregate:always() && needs.discover.outputs.count != '0'. A skippeddiscoveryields an emptycount, which is!= '0', so it runs.allow-list-dns-check.yamlnotify:if: ${{ always() }}, so it runs.- The
notify-failurejobs usealways()as well. They react tofailure/cancelled, notskipped, but gate them explicitly anyway (requirement 3).
Every job that calls always() needs the owner/schedule condition in its own if:. A simple approach is to give each job in the affected workflows the same guard, for example:
if: github.event_name != 'schedule' || github.repository_owner == 'lfreleng-actions'For a reusable-workflow caller job (discover: uses: '$/...'), put the if: on that job too. Keep the existing yamllint style (>- folded ${{ }} blocks, # yamllint disable-line rule:line-length where needed), and do not change any action pin.
Documentation
- Update each touched workflow's header comment to say that its schedule and Slack alerts run only under
lfreleng-actions, and that a fork can dispatch it without posting to Slack. - Update
README.mdwhere it describes these schedules and Slack alerts (Slack Setup section, and the per-workflow descriptions that mention#releng-scm), editing the existing text in place.
Acceptance criteria
- In a fork, a scheduled run of any workflow above runs no jobs and does not finish as failed.
- In a fork, a
workflow_dispatchrun still runs its jobs, never runs a Slack step, and states in the step summary or a notice that Slack was skipped because the repository owner is notlfreleng-actions. - In
lfreleng-actions/.github, scheduled and dispatched runs behave as before, Slack included. - The owner check reads
github.repository_owner, neverinputs.org. -
actionlintandyamllintpass,zizmor --persona auditor .github/workflows/reports zero findings, andprek run --files <changed files>passes. - No new secrets, variables, permissions or action pins.
Activity