Skip to content

Commit 2647b90

Browse files
authored
Merge pull request #12354 from CesiumGS/cla-label
Add label to prs that need a CLA signed
2 parents dcaf957 + f25640c commit 2647b90

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

.github/actions/check-for-CLA/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ const postCommentOnPullRequest = async (hasSignedCLA, errorFoundOnCLACheck) => {
142142
);
143143
};
144144

145+
const addLabelToPullRequest = async () => {
146+
const octokit = new Octokit();
147+
148+
return octokit.request(
149+
`POST /repos/${PULL_REQUST_INFO.owner}/${PULL_REQUST_INFO.repoName}/issues/${PULL_REQUST_INFO.id}/labels`,
150+
{
151+
labels: ["PR - Needs Signed CLA"],
152+
headers: {
153+
authorization: `bearer ${PULL_REQUST_INFO.gitHubToken}`,
154+
accept: "application/vnd.github+json",
155+
"X-GitHub-Api-Version": "2022-11-28",
156+
},
157+
},
158+
);
159+
};
160+
145161
const main = async () => {
146162
let hasSignedCLA;
147163
let errorFoundOnCLACheck;
@@ -153,6 +169,9 @@ const main = async () => {
153169
}
154170

155171
await postCommentOnPullRequest(hasSignedCLA, errorFoundOnCLACheck);
172+
if (!hasSignedCLA) {
173+
await addLabelToPullRequest();
174+
}
156175
};
157176

158177
main();

.github/workflows/cla.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: node index.js
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
PULL_REQUEST_ID: ${{ github.event.number }}
26+
PULL_REQUEST_ID: ${{ github.event.number }}
2727
GOOGLE_KEYS: ${{ secrets.GOOGLE_KEYS }}
28-
INDIVIDUAL_CLA_SHEET_ID: ${{ secrets.INDIVIDUAL_CLA_SHEET_ID }}
29-
CORPORATE_CLA_SHEET_ID: ${{ secrets.CORPORATE_CLA_SHEET_ID }}
28+
INDIVIDUAL_CLA_SHEET_ID: ${{ secrets.INDIVIDUAL_CLA_SHEET_ID }}
29+
CORPORATE_CLA_SHEET_ID: ${{ secrets.CORPORATE_CLA_SHEET_ID }}

0 commit comments

Comments
 (0)