Skip to content

Update CLA checker workflow - #44

Merged
James Bruten (james-bruten-mo) merged 17 commits into
mainfrom
develop
Dec 10, 2025
Merged

Update CLA checker workflow#44
James Bruten (james-bruten-mo) merged 17 commits into
mainfrom
develop

Conversation

@yaswant

Copy link
Copy Markdown
Collaborator

Adding some changes to existing cla-checker workflow:

  • CONTRIBUTORS -> CONTRIBUTORS.md for easy access to contributors list from a repository
  • Check against self-deletion of contributor
  • Clean PR page by removing duplicate bot messages

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the logic around removing comments looks ok.
I'm not sure the check of cla removed is correct though. This will always fail when an author is relying on their name being on base and branching from before that. This will be both annoying for developers who do multiple PRs per release, and also make conflicts and duplications more likely.
I also think the grep should be more permissive in this workflow - we're checking for the author existing, not correct formatting of the file.

Comment thread .github/workflows/cla-check.yaml Outdated
if [ -f "CONTRIBUTORS" ]; then
if grep -q "^$AUTHOR" CONTRIBUTORS; then
if [ -f "CONTRIBUTORS.md" ]; then
if grep -q "| $AUTHOR |" CONTRIBUTORS.md || grep -q "| $AUTHOR " CONTRIBUTORS.md; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting this as a markdown table is sensible, but I think this check shouldn't be reliant on correct formatting, particularly with whitespace.
So keep as grep -q "$AUTHOR"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the check for the username to be in between | and |. Perhaps we can relax with the spaces around the username. Imagine a substring collision in another column for a different entry...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah fair enough, something like grep -qE "|\s*$AUTHOR\s*|" CONTRIBUTORS.md (not tested!)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should work, I think we probably ned to escape the pipes?

grep -qE "\|\s*$AUTHOR\s*\|" CONTRIBUTORS.md

Comment thread .github/workflows/cla-check.yaml Outdated
echo "signed=true" >> $GITHUB_OUTPUT
echo "✅ $AUTHOR has updated their CLA signature in CONTRIBUTORS file."
if [ -f "CONTRIBUTORS.md" ]; then
if grep -q "| $AUTHOR |" CONTRIBUTORS.md || grep -q "| $AUTHOR " CONTRIBUTORS.md; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment thread .github/workflows/cla-check.yaml Outdated
const author = context.payload.pull_request.user.login;

// Check if contributor was on base but removed themselves from PR
const removedFromPr = signedOnBase && !signedOnPr;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this complex enough? Once the first PR is on they'll have signed on base. But I would imagine they don't need to add themselves to the CONTRIBUTORS.md in subsequent PRs as it's already on base. This logic will fail in that scenario. I think it should be checking the diff of the CONTRIBUTORS file and looking for their username being removed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm.. my brain was frozen at 1am. Agree, we should test different scenarios.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point and as discussed I've updated the workflow to handle the scenario where a contributor has already signed the CLA in the base branch. Here's what changed:

  • a new step to check if CONTRIBUTORS.md was modified in the PR by comparing changed files between base and PR branch.
  • removedFromPr now only triggers if the contributor was on base, not on PR, and they modified the CONTRIBUTORS.md file (intentionally removed themselves)
  • cla_met now passes if either contributor is signed on both base and PR branches, OR
    contributor is signed on base branch AND didn't touch the CONTRIBUTORS.md file in their PR.

@james-bruten-mo

Copy link
Copy Markdown
Collaborator

Tagging Jenny Hickson (@jennyhickson) in this in case she has thoughts on the removal process

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the git diff logic, that looks like it should do what we want it to!

@james-bruten-mo
James Bruten (james-bruten-mo) merged commit abbdcf8 into main Dec 10, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check that signature hasn't been removed from the base branch

2 participants