-
Notifications
You must be signed in to change notification settings - Fork 3k
52 lines (44 loc) · 1.72 KB
/
Copy pathdco-check.yaml
File metadata and controls
52 lines (44 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: CI / DCO Check
on:
pull_request:
types: [opened, edited, synchronize, reopened]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
dco-check:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Check Dependabot DCO bypass
id: dco-bypass
env:
USERNAME: ${{ github.event.pull_request.user.login }}
run: |
# GitHub exposes the same trusted app as dependabot[bot] in event
# payloads and app/dependabot through some GraphQL PR surfaces.
if [[ "$USERNAME" == "dependabot[bot]" || "$USERNAME" == "app/dependabot" ]]; then
echo "bypass=true" >> "$GITHUB_OUTPUT"
echo "Dependabot is exempt from the PR-body DCO declaration."
else
echo "bypass=false" >> "$GITHUB_OUTPUT"
echo "The PR-body DCO declaration is required."
fi
- name: Check PR body for Signed-off-by
if: ${{ steps.dco-bypass.outputs.bypass != 'true' }}
env:
PR_BODY: ${{ github.event.pull_request.body }}
run: |
normalized_body="$(printf '%s\n' "$PR_BODY" | tr -d '\r')"
if ! printf '%s\n' "$normalized_body" | grep -qP '^Signed-off-by:\s+.+\s+<[^<>]+>$'; then
echo "::error::PR description must contain a DCO sign-off line."
echo "::error::Expected format: Signed-off-by: Your Name <your-email@example.com>"
exit 1
fi
echo "PR description contains a DCO sign-off."