Skip to content

CI: Run schedules and Slack alerts only in lfreleng-actions #293

Open

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:

https://github.com/modeseven-lfreleng-actions/.github/actions/runs/39251679730

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.

  1. Schedules run only under lfreleng-actions. When github.event_name == 'schedule' and github.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.
  2. 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.
  3. Slack posts only under lfreleng-actions, whatever the trigger. When github.repository_owner != 'lfreleng-actions', no slackapi/slack-github-action step may run. This covers dispatch runs, including allow-list-dns-check.yaml's test_notification input. 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 (the notify-failure jobs), gate the whole job.
  4. 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.yaml aggregate: always() && needs.discover.outputs.count != '0'. A skipped discover yields an empty count, which is != '0', so it runs.
  • allow-list-dns-check.yaml notify: if: ${{ always() }}, so it runs.
  • The notify-failure jobs use always() as well. They react to failure/cancelled, not skipped, 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.md where 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_dispatch run 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 not lfreleng-actions.
  • In lfreleng-actions/.github, scheduled and dispatched runs behave as before, Slack included.
  • The owner check reads github.repository_owner, never inputs.org.
  • actionlint and yamllint pass, zizmor --persona auditor .github/workflows/ reports zero findings, and prek run --files <changed files> passes.
  • No new secrets, variables, permissions or action pins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CI

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions