Skip to content

Commit

Permalink
Merge pull request #12354 from CesiumGS/cla-label
Browse files Browse the repository at this point in the history
Add label to prs that need a CLA signed
  • Loading branch information
ggetz authored Dec 9, 2024
2 parents dcaf957 + f25640c commit 2647b90
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/actions/check-for-CLA/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,22 @@ const postCommentOnPullRequest = async (hasSignedCLA, errorFoundOnCLACheck) => {
);
};

const addLabelToPullRequest = async () => {
const octokit = new Octokit();

return octokit.request(
`POST /repos/${PULL_REQUST_INFO.owner}/${PULL_REQUST_INFO.repoName}/issues/${PULL_REQUST_INFO.id}/labels`,
{
labels: ["PR - Needs Signed CLA"],
headers: {
authorization: `bearer ${PULL_REQUST_INFO.gitHubToken}`,
accept: "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
},
},
);
};

const main = async () => {
let hasSignedCLA;
let errorFoundOnCLACheck;
Expand All @@ -153,6 +169,9 @@ const main = async () => {
}

await postCommentOnPullRequest(hasSignedCLA, errorFoundOnCLACheck);
if (!hasSignedCLA) {
await addLabelToPullRequest();
}
};

main();
6 changes: 3 additions & 3 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: node index.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_ID: ${{ github.event.number }}
PULL_REQUEST_ID: ${{ github.event.number }}
GOOGLE_KEYS: ${{ secrets.GOOGLE_KEYS }}
INDIVIDUAL_CLA_SHEET_ID: ${{ secrets.INDIVIDUAL_CLA_SHEET_ID }}
CORPORATE_CLA_SHEET_ID: ${{ secrets.CORPORATE_CLA_SHEET_ID }}
INDIVIDUAL_CLA_SHEET_ID: ${{ secrets.INDIVIDUAL_CLA_SHEET_ID }}
CORPORATE_CLA_SHEET_ID: ${{ secrets.CORPORATE_CLA_SHEET_ID }}

0 comments on commit 2647b90

Please sign in to comment.