Skip to content

Commit 13008d1

Browse files
authored
Merge pull request #2 from metorial/herber-patch-1
Replace legal check steps with reusable workflow
2 parents fd1c7dd + 63ab49b commit 13008d1

1 file changed

Lines changed: 2 additions & 37 deletions

File tree

.github/workflows/legal.yml

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,8 @@ on:
55
types: [opened, edited, synchronize, reopened]
66

77
jobs:
8-
check-legal-boilerplate:
9-
runs-on: ubuntu-latest
8+
legal:
109
permissions:
1110
pull-requests: write
1211
contents: read
13-
14-
steps:
15-
- name: Check for legal boilerplate
16-
id: check
17-
uses: actions/github-script@v7
18-
with:
19-
script: |
20-
let staffContributors = ['herber', 'RahmeKarim'];
21-
let prAuthor = context.payload.pull_request.user.login;
22-
23-
if (staffContributors.includes(prAuthor)) {
24-
console.log(`Skipping legal check: ${prAuthor} is in staff list.`);
25-
return;
26-
}
27-
28-
let requiredText = `By submitting this pull request, I'm saying I wrote these changes (or have the right to submit them), and that Metorial can use them however they like - including in their open source projects or any proprietary versions they offer. I still keep the rights to my code, but Metorial can use, modify, and relicense it however they like.`;
29-
30-
let body = context.payload.pull_request.body || "";
31-
32-
if (body.includes(requiredText)) {
33-
core.setOutput("legal_check_passed", "true");
34-
} else {
35-
let issue_number = context.payload.pull_request.number;
36-
let repo = context.repo.repo;
37-
let owner = context.repo.owner;
38-
39-
await github.rest.issues.createComment({
40-
owner,
41-
repo,
42-
issue_number,
43-
body: `👋 Hi! Your pull request is missing the required legal boilerplate.\nPlease copy and paste the following text into the PR description:\n\n\`\`\`\n${requiredText}\n\`\`\`\n\nThanks for contributing to Metorial!`
44-
});
45-
46-
core.setFailed("Missing required legal boilerplate in PR description.");
47-
}
12+
uses: metorial/.github/.github/workflows/legal-boilerplate.yml@main

0 commit comments

Comments
 (0)