Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update check-cla to customize which CLA repo to use #91

Merged
merged 30 commits into from
Apr 27, 2023
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ee9d811
Update check-cla to customize which CLA repo
kenodegard Apr 3, 2023
ec9f0b4
Adds set-commit-status action
kenodegard Apr 4, 2023
a3dded4
Update READMEs and descriptions
kenodegard Apr 4, 2023
6c83ecc
Use JavaScript, not TypeScript
kenodegard Apr 4, 2023
2b2d732
Don't need to authenticate Octokit object
kenodegard Apr 4, 2023
5361102
Remove redundant debug statements
kenodegard Apr 4, 2023
528c212
Dumb JS split
kenodegard Apr 4, 2023
83dab52
Flatten await and keep try-catch simple
kenodegard Apr 4, 2023
b3b9940
Set author/committer and delete branch on merge
kenodegard Apr 4, 2023
1542cb4
debugging
kenodegard Apr 4, 2023
261fc09
Remove unused sha and labels
kenodegard Apr 5, 2023
1928626
Update ids
kenodegard Apr 5, 2023
00ae91f
Allow custom author/committer
kenodegard Apr 5, 2023
8eee82e
Fix json formatting, update PR url
kenodegard Apr 5, 2023
4729d17
Fix inputs
kenodegard Apr 5, 2023
b2db323
Fallback sha
kenodegard Apr 5, 2023
9bdcc51
debugging comment payload
kenodegard Apr 5, 2023
43ec963
Remove temporary raw const
kenodegard Apr 5, 2023
d8454ec
Optional react to comment
kenodegard Apr 5, 2023
8ee0ba0
Add token to reaction
kenodegard Apr 5, 2023
5ab5369
Replace rocket with eyes
kenodegard Apr 5, 2023
ebb06e5
Reduce noise
kenodegard Apr 5, 2023
a4ac617
Include classic PAT instructions
kenodegard Apr 5, 2023
4f67ffb
GFM
kenodegard Apr 5, 2023
d66d4eb
Extract PR number for sticky comment
kenodegard Apr 5, 2023
71c4f55
Support both PRs and "issues"
kenodegard Apr 5, 2023
6146699
Extract metadata whether triggered as a PR or "issue" comment
kenodegard Apr 5, 2023
5616a98
Group metadata steps
kenodegard Apr 5, 2023
3c9f741
Update comments and step names
kenodegard Apr 5, 2023
ae8e19e
Use correct url
kenodegard Apr 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update comments and step names
kenodegard committed Apr 5, 2023
commit 3c9f7412ddb7cbae8e5c67199ab6edaa2991f1fa
29 changes: 16 additions & 13 deletions check-cla/action.yml
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ runs:
using: composite
steps:
# if triggered by a comment, leave a reaction
- name: Comment Reaction
- name: React to comment
uses: peter-evans/[email protected]
if: github.event_name == 'issue_comment'
with:
@@ -98,30 +98,32 @@ runs:
core.setOutput('has_signed', has_signed);
core.debug(`has_signed: ${has_signed}`);

# add [cla-signed] label if actor has already signed
- name: Add label
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add this to a separate javascript file? This is started to get long enough to warrant that, imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Specifying these JS blocks in separate files requires:

steps:
  - uses: actions/checkout@v3
  - uses: actions/github-script@v6
    with:
      script: |
        const script = require('./path/to/script.js')
        await script({github, context, core})

My problem with this is the checkout step which will make it harder to version our actions.

There's an open request for something better: actions/github-script#326

Copy link
Member

Choose a reason for hiding this comment

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

It's a common pattern for actions to include all JS inlined, even if it's not great, let's follow that for now

# if contributor has already signed, add [cla-signed] label
- name: Add label to PR
uses: actions-ecosystem/[email protected]
if: steps.metadata.outputs.has_signed == 'true' && steps.metadata.outputs.has_label == 'false'
with:
github_token: ${{ inputs.token }}
labels: ${{ inputs.label }}

# remove [cla-signed] label if actor has not signed yet
- name: Remove label
# if contributor has not signed yet, remove [cla-signed] label
- name: Remove label to PR
uses: actions-ecosystem/[email protected]
if: steps.metadata.outputs.has_signed == 'false' && steps.metadata.outputs.has_label == 'true'
with:
github_token: ${{ inputs.token }}
labels: ${{ inputs.label }}

# checkout cla_repo to update cla_path
- uses: actions/checkout@v3
# if unsigned, checkout cla_repo
- name: Clone CLA singee repo
uses: actions/checkout@v3
if: steps.metadata.outputs.has_signed == 'false'
with:
repository: ${{ inputs.cla_repo }}

# update cla_path
- shell: python
# if unsigned, update cla_path
- name: Add contributor as a CLA signee
shell: python
if: steps.metadata.outputs.has_signed == 'false'
run: |
import json
@@ -133,8 +135,9 @@ runs:
signees["contributors"].sort()
path.write_text(json.dumps(signees, indent=2))

# create PR
- uses: peter-evans/create-pull-request@v4
# if unsigned, create PR
- name: Create PR with new CLA signee
uses: peter-evans/create-pull-request@v4
id: pull
if: steps.metadata.outputs.has_signed == 'false'
with:
@@ -151,8 +154,8 @@ runs:

Xref ${{ steps.metadata.outputs.url }}

# create sticky comment if not signed
- name: Create comment
# if unsigned, create sticky comment
- name: Create comment regarding missing CLA signature
uses: marocchino/sticky-pull-request-comment@v2
if: steps.metadata.outputs.has_signed == 'false'
with: