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
40 changes: 40 additions & 0 deletions .github/workflows/reusable-dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Reusable — DCO sign-off

on:
workflow_call:
inputs:
runner:
description: 'Override the runner label. Empty (default) auto-selects by repo visibility: private repos use ferrlabs-k8s-light, public repos use ubuntu-latest.'
type: string
required: false
default: ''

concurrency:
group: reusable-dco-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

Comment thread
ferrfleet-interne[bot] marked this conversation as resolved.
jobs:
sign-off:
name: sign-off
runs-on: ${{ inputs.runner != '' && inputs.runner || (github.event.repository.private && 'ferrlabs-k8s-light' || 'ubuntu-latest') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- name: Every commit needs a Signed-off-by line
env:
BASE_REF: ${{ github.base_ref }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
missing=$(git log --no-merges --format='%H %s' --invert-grep --grep='^Signed-off-by: ' \
"origin/${BASE_REF}..${HEAD_SHA}")
if [ -n "$missing" ]; then
echo "Commits without a sign-off:"
echo "$missing"
echo "Run: git rebase --signoff origin/${BASE_REF}"
exit 1
fi
1 change: 1 addition & 0 deletions default.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"helpers:pinGitHubActionDigests"
],
"dependencyDashboard": false,
"commitBody": "Signed-off-by: ferrlabs-renovate[bot] <282300760+ferrlabs-renovate[bot]@users.noreply.github.com>",
"rebaseWhen": "conflicted",
"recreateWhen": "always",
"minimumReleaseAge": "1 day",
Expand Down
1 change: 1 addition & 0 deletions workflow-templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GitHub-discovered workflow templates. They appear under **Actions → New workfl
| [`scorecard`](scorecard.yml) | OpenSSF Scorecard supply-chain risk score | All public repos and key private repos. |
| [`security-scan`](security-scan.yml) | Reusable: gitleaks (secrets) + osv-scanner (CVE) + trufflehog (deep history) | Every repo — call the shared workflow from `FerrLabs/.github`. |
| [`pr-title`](pr-title.yml) | Conventional Commits validation on PR titles | Every repo (mandatory because we squash-merge). |
| [`dco`](dco.yml) | Reusable: every commit of a PR needs a `Signed-off-by` line | Repos that enforce the DCO. |
| [`release`](release.yml) | Auto-release on push to main with `FerrLabs/FerrFlow@v7` | Repos that ship semver releases. |
| [`docker-publish`](docker-publish.yml) | Reusable: hadolint + multi-arch build + Trivy + cosign keyless + SBOM | Repos that publish a container image. |

Expand Down
7 changes: 7 additions & 0 deletions workflow-templates/dco.properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "FerrLabs — DCO sign-off",
"description": "Fails a PR when one of its commits has no Signed-off-by line. Fix with git rebase --signoff.",
"iconName": "ferrlabs",
"categories": ["Continuous integration"],
"filePatterns": [".*"]
}
12 changes: 12 additions & 0 deletions workflow-templates/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: DCO

on:
pull_request:
types: [opened, edited, synchronize, reopened]

permissions:
contents: read

jobs:
sign-off:
uses: FerrLabs/.github/.github/workflows/reusable-dco.yml@main

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: security-scan.yml pins its reusable workflow to a SHA with a # main comment; this one floats on @main. It can't be pinned until reusable-dco.yml is on main, so a follow-up that pins it to the merge commit would keep the templates consistent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changed here: the SHA only exists once this merges. I'll pin the template (and the callers rolled out to other repos) to the merge commit in a follow-up.

Loading