Files
cozystack/.github/workflows/scorecard.yml
T
Alexey Artamonov d6a4835ea5 ci(workflows): run push and schedule workflows only in cozystack/cozystack
A private copy of the repository, used to verify an embargoed security
fix because GitHub runs no CI in an advisory's temporary fork, receives
every workflow file with each sync. Without a repository guard, each
sync and each cron tick there would build, publish, prune and cut
releases with that copy's credentials. Pull request events stay allowed
in the workflows that also check pull requests, since checking the fix
is what the copy is for.

Every job carries the guard rather than only the root jobs, because a
job whose condition calls a status function runs even when the job it
needs was skipped. A contract test holds new push and schedule
workflows to the same rule. It reads 'on' in every form GitHub accepts,
requires whatever follows the guard to be one parenthesized group,
because && binds tighter than || and a trailing '|| (...)' would reopen
the job, and fails on a workflow it cannot parse instead of leaving
that workflow unchecked.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
Assisted-by: LLM
2026-11-25 15:49:33 +03:00

59 lines
2.3 KiB
YAML

name: OpenSSF Scorecard
on:
branch_protection_rule:
schedule:
# Run weekly on Mondays at 06:00 UTC.
- cron: '0 6 * * 1'
workflow_dispatch:
# Declare default permissions as read-only.
permissions: read-all
jobs:
analysis:
if: github.repository == 'cozystack/cozystack'
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to publish results to the public scorecard.dev API
# (OIDC token allows publish without storing long-lived credentials).
id-token: write
# Needed to read repository contents.
contents: read
# Needed to read workflow definitions for the Dangerous-Workflow check.
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run analysis
uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
with:
results_file: results.sarif
results_format: sarif
# The default GITHUB_TOKEN cannot read branch-protection settings, so
# the Branch-Protection check is scored on partial data. Provide a PAT
# with admin:read on the repo as the SCORECARD_TOKEN secret to let it
# see the full ruleset; falls back to the default token when unset, so
# this is a no-op until the secret is added.
repo_token: ${{ secrets.SCORECARD_TOKEN || github.token }}
# Publish the results to the OpenSSF Scorecard public API so the
# project appears at https://scorecard.dev/viewer/?uri=github.com/cozystack/cozystack
publish_results: true
# SARIF is kept as a downloadable artifact only. It is intentionally NOT
# uploaded to GitHub code-scanning: Scorecard posts one alert per check,
# which floods the Security > Code scanning dashboard and buries CodeQL's
# first-party findings. The public scorecard.dev badge (publish_results
# above) is the canonical view of these results.
- name: Upload SARIF as artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: scorecard-sarif
path: results.sarif
retention-days: 5