Skip to content

Commit a36df0a

Browse files
authored
Switch to reusable DCO (#728)
Signed-off-by: Dscano <d.scano89@gmail.com>
1 parent 5f4d62d commit a36df0a

File tree

1 file changed

+2
-49
lines changed

1 file changed

+2
-49
lines changed

.github/workflows/dco-welcome.yml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,5 @@ on:
66

77
jobs:
88
dco-help:
9-
runs-on: ubuntu-latest
10-
permissions:
11-
contents: read
12-
issues: write
13-
pull-requests: write
14-
if: |
15-
github.event.check_run.conclusion == 'failure' &&
16-
contains(github.event.check_run.name, 'DCO') &&
17-
github.event.check_run.pull_requests[0] != null
18-
steps:
19-
- name: Load PR Context
20-
id: pr-context
21-
uses: actions/github-script@v7
22-
with:
23-
script: |
24-
const prs = context.payload.check_run.pull_requests || [];
25-
if (prs.length === 0) {
26-
core.setOutput('should_comment', 'false');
27-
return;
28-
}
29-
30-
const prNumber = prs[0].number;
31-
const { data: pr } = await github.rest.pulls.get({
32-
owner: context.repo.owner,
33-
repo: context.repo.repo,
34-
pull_number: prNumber,
35-
});
36-
37-
const shouldComment = ['FIRST_TIME_CONTRIBUTOR', 'NONE'].includes(pr.author_association);
38-
core.setOutput('pr_number', String(prNumber));
39-
core.setOutput('should_comment', shouldComment ? 'true' : 'false');
40-
41-
- name: Post DCO Instructions
42-
if: steps.pr-context.outputs.should_comment == 'true'
43-
uses: peter-evans/create-or-update-comment@v3
44-
with:
45-
issue-number: ${{ steps.pr-context.outputs.pr_number }}
46-
body: |
47-
Welcome to the project, @${{ github.actor }}!
48-
49-
It looks like this is your first contribution. We noticed the **DCO (Developer Certificate of Origin)** check might fail if your commits aren't signed.
50-
51-
To fix this, please ensure every commit has a `Signed-off-by: Name <email>` line. You can do this automatically by using the `-s` flag:
52-
`git commit -s -m "Your message"`
53-
54-
For existing commits, you can fix them with:
55-
`git commit --amend --signoff` or `git rebase -i HEAD~N --signoff` (where N is the number of commits)
56-
The Developer Community DCO guide also provides helpful tips on fixing DCO inconveniences. Setting a commit hook in the git repository will automate adding the DCO signoff.
57-
See https://github.com/p4lang/governance/wiki/P4-DCO-Guidelines for information.
9+
# https://github.com/p4lang/.github/blob/main/.github/workflows/dco-welcome-reusable.yml
10+
uses: p4lang/.github/.github/workflows/dco-welcome-reusable.yml@main

0 commit comments

Comments
 (0)