From 6c3f97c7f0b8a955c5e54a58db223db19c072a8a Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 17 Nov 2026 23:44:15 -0500 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=94=8D=20Add=20FOSSA=20license=20scan?= =?UTF-8?q?=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- .github/workflows/fossa.yml | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/fossa.yml diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml new file mode 100644 index 0000000..a281a24 --- /dev/null +++ b/.github/workflows/fossa.yml @@ -0,0 +1,59 @@ +name: FOSSA license scan + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + +permissions: + contents: read + +jobs: + fossa: + name: FOSSA license scan + runs-on: ubuntu-latest + timeout-minutes: 15 + env: + FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }} + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + # Forks and repos without the secret skip the scan instead of failing + # the check on a missing input; the scan activates once FOSSA_API_KEY is set. + - name: Skip when FOSSA_API_KEY is not configured + if: env.FOSSA_API_KEY == '' + run: echo "FOSSA_API_KEY secret not set; skipping FOSSA scan." >> "$GITHUB_STEP_SUMMARY" + + # The key must be a push-only token from the *CNCF* FOSSA organization so + # the project lands in the CNCF instance (cncf/sandbox#545). `team` takes + # the team NAME, not the numeric id, and is honored only on the very first + # upload that creates the project (fossa-cli docs/references/files/fossa-yml.md). + # With `run-tests: true` the action runs ONLY `fossa test` (no analyze) + # and forwards `team`/`branch` to it, which `fossa test` rejects. So: + # always analyze (upload), then on PRs run the policy test separately. + - name: Run FOSSA scan + if: env.FOSSA_API_KEY != '' + uses: fossas/fossa-action@29693cc50323968e039056be419b32989fc5880c # v2.0.0 + with: + api-key: ${{ secrets.FOSSA_API_KEY }} + project: hivecommons/hivecommons.github.io + team: Hive Commons + branch: ${{ github.head_ref || github.ref_name }} + + - name: Run FOSSA policy test + if: env.FOSSA_API_KEY != '' && github.event_name == 'pull_request' + uses: fossas/fossa-action@29693cc50323968e039056be419b32989fc5880c # v2.0.0 + with: + api-key: ${{ secrets.FOSSA_API_KEY }} + project: hivecommons/hivecommons.github.io + run-tests: true + test-diff-revision: ${{ github.event.pull_request.base.sha }} From 506a493c53263dd1e7acb329a3c3c30ada46a517 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 17 Nov 2026 23:46:42 -0500 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=8D=20FOSSA:=20fall=20back=20to=20?= =?UTF-8?q?plain=20test=20when=20PR=20base=20has=20no=20scan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- .github/workflows/fossa.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index a281a24..5c7db08 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -49,11 +49,27 @@ jobs: team: Hive Commons branch: ${{ github.head_ref || github.ref_name }} + # Policy test on PRs. The diff test compares against the base commit's + # scan; a repo whose base was never scanned (new project, or the base + # push scan did not run) has no such revision, and `fossa test --diff` + # fails with "Revision for locator ... was not found". Only in that + # specific case fall back to a plain `fossa test` of the PR revision just + # uploaded above. Any other failure (including real policy violations + # from either test) still fails the job. Reuses the CLI installed by the + # Run FOSSA scan step. - name: Run FOSSA policy test if: env.FOSSA_API_KEY != '' && github.event_name == 'pull_request' - uses: fossas/fossa-action@29693cc50323968e039056be419b32989fc5880c # v2.0.0 - with: - api-key: ${{ secrets.FOSSA_API_KEY }} - project: hivecommons/hivecommons.github.io - run-tests: true - test-diff-revision: ${{ github.event.pull_request.base.sha }} + env: + FOSSA_BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: | + set +e + out="$(fossa test --project hivecommons/hivecommons.github.io --diff "$FOSSA_BASE_SHA" 2>&1)" + rc=$? + printf '%s\n' "$out" + if [ "$rc" -ne 0 ] && printf '%s' "$out" | grep -q 'was not found'; then + echo "Base revision $FOSSA_BASE_SHA has no FOSSA scan; testing the PR revision without --diff." + echo "FOSSA base revision has no scan; policy test ran on the PR revision without diff." >> "$GITHUB_STEP_SUMMARY" + fossa test --project hivecommons/hivecommons.github.io + rc=$? + fi + exit "$rc" From 1262ad5949ec78745b1507f55aad0b6e70e633c8 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 17 Nov 2026 23:49:27 -0500 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=8D=20FOSSA:=20do=20not=20persist?= =?UTF-8?q?=20checkout=20credentials=20(workflow-hardening=20test)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- .github/workflows/fossa.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/fossa.yml b/.github/workflows/fossa.yml index 5c7db08..8f618c3 100644 --- a/.github/workflows/fossa.yml +++ b/.github/workflows/fossa.yml @@ -26,6 +26,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false # Forks and repos without the secret skip the scan instead of failing # the check on a missing input; the scan activates once FOSSA_API_KEY is set. From e60ab8323d07acc94a8074142b760af051637752 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Tue, 17 Nov 2026 23:52:07 -0500 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=93=9D=20Document=20the=20FOSSA=20lic?= =?UTF-8?q?ense=20scan=20workflow=20in=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Anderson --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0bb5a2f..44f24f9 100644 --- a/README.md +++ b/README.md @@ -485,6 +485,8 @@ requirements first (see [issue #73](https://github.com/hivecommons/hivecommons.g **OpenSSF Scorecard** (`.github/workflows/scorecard.yml`) — Runs OpenSSF security scorecard analysis on every push to `main`, weekly (cron `23 5 * * 1`), and on manual dispatch from the Actions tab. Results are published to GitHub's code scanning dashboard. +**FOSSA license scan** (`.github/workflows/fossa.yml`) — Uploads the repository to the CNCF FOSSA instance on every push to `main` and every pull request targeting `main`, and on manual dispatch from the Actions tab. Pull requests also run a license policy test. The scan is skipped when the `FOSSA_API_KEY` secret is not configured. + **Close linked issues** (`.github/workflows/close-linked-issues.yml`) — Automatically closes issues linked to a closed pull request when a PR transitions to `closed`. **Incident response** — When a bad deploy or incident impacts visitors of `hivecommons.dev` (broken pages, dead redirects, domain issues), use the [postmortem template](runbooks/postmortem-template.md) to document it blamelessly and fact-based. Coordinate recovery using the [release-rollback runbook](runbooks/release-rollback.md).