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 action #204

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
eb8ff20
Update check-cla
kenodegard Aug 16, 2024
7d183f9
Action versions
kenodegard Sep 9, 2024
ad3f3c5
Provide default empty CLA file for read-file action
kenodegard Aug 16, 2024
6264ecd
Use user id instead of login to avoid invalid chars
kenodegard Sep 10, 2024
41d7ce6
Formatting
kenodegard Sep 10, 2024
bae31a6
Add commands block
kenodegard Sep 10, 2024
e2d79c4
Code review
kenodegard Dec 17, 2024
2c57bc8
Merge remote-tracking branch 'upstream/main' into check-cla
kenodegard Dec 17, 2024
3cd9bcd
Convert all `env` to `outputs`
kenodegard Dec 18, 2024
4f5b884
Cleanup inputs
kenodegard Dec 18, 2024
45c6f0d
Use correct token
kenodegard Dec 18, 2024
76778d8
Update input descriptions
kenodegard Dec 18, 2024
a2a986d
Add default label
kenodegard Dec 18, 2024
1fe03ca
Fix token & url
kenodegard Dec 18, 2024
51bd068
Remove label detection
kenodegard Dec 18, 2024
718892a
Fork the CLA repo, not the current repo
kenodegard Dec 18, 2024
23f192f
Restore label detection
kenodegard Dec 19, 2024
ae5aeea
Improve if condition
kenodegard Dec 19, 2024
c5b6228
Correct if clause
kenodegard Dec 19, 2024
cecdda9
Change Python requirement to >=3.8
kenodegard Dec 20, 2024
33a28fc
Add pr-token
kenodegard Dec 20, 2024
4e735d7
Correct default fork-token
kenodegard Dec 20, 2024
e190cd4
Always comment if the CLA is unsigned
kenodegard Dec 20, 2024
1e808ac
Add magic-command input
kenodegard Dec 20, 2024
9328e55
Add author input
kenodegard Dec 20, 2024
07930b6
Update README.md
kenodegard Dec 20, 2024
bd357d2
Standardize Python
kenodegard Jan 9, 2025
5e0833d
Enable dependabot updates for pip
kenodegard Jan 9, 2025
cacdba9
Add analyze step with automated error reports
kenodegard Jan 9, 2025
e145ba9
Minor cleanup
kenodegard Jan 9, 2025
92e1cce
Update existing failures
kenodegard Jan 9, 2025
8c27a79
Merge remote-tracking branch 'upstream/scheduled-tests' into check-cla
kenodegard Jan 9, 2025
3ef96d8
Rename
kenodegard Jan 9, 2025
ae8a500
Compute hash
kenodegard Jan 9, 2025
b1cd7ce
Merge remote-tracking branch 'upstream/scheduled-tests' into check-cla
kenodegard Jan 9, 2025
23e1aa9
Add test_check_cla.py
kenodegard Jan 9, 2025
f65ee0a
Update README.md
kenodegard Jan 10, 2025
75b1ef2
Merge remote-tracking branch 'upstream/main' into check-cla
kenodegard Jan 10, 2025
044f2f2
Add check-cla to tests.yml
kenodegard Jan 21, 2025
92dd5ac
Update GHA version
kenodegard Jan 21, 2025
fee1f2d
Use Python>=3.9
kenodegard Jan 21, 2025
cf9c47b
Clone into .github_cache/actions
kenodegard Jan 21, 2025
f261c0b
Fix contributor-login
kenodegard Jan 21, 2025
77534be
Use local action
kenodegard Jan 21, 2025
dab10d8
Merge remote-tracking branch 'upstream/main' into check-cla
kenodegard Jan 22, 2025
db7d393
Fix path
kenodegard Jan 22, 2025
c2177b8
Debug diff
kenodegard Jan 22, 2025
8df586d
Rename commit-status-label to commit-status-context
kenodegard Jan 22, 2025
57d2962
Merge branch 'main' into check-cla
kenodegard Jan 24, 2025
d658f01
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 24, 2025
a624deb
Update .github/workflows/tests.yml
kenodegard Jan 24, 2025
b8aab92
Bump conda/actions version
kenodegard Jan 24, 2025
a5ccb3e
Update .github/workflows/tests.yml
kenodegard Jan 24, 2025
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
33 changes: 32 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,47 @@ jobs:
${{ steps.templates-error.outputs.summary }}
GITHUB_TOKEN: ${{ secrets.SANDBOX_TEMPLATE_TOKEN }}

check-cla:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout Source
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Check CLA
uses: ./check-cla
with:
label: cla-test
repository: conda-sandbox/cla
contributor-id: ${{ github.event.pull_request.number }}
# NOTE: using a real username here will will trigger GH notifications to that user, we wish
# to avoid that, GH restricts certain keywords, 'login' is one of those restricted keywords
# and hence is not a real username, https://github.com/login is the login page, not a user
contributor-login: login
commit-status-context: CLA test
token: ${{ secrets.SANDBOX_CLA_TOKEN }}
pr-token: ${{ secrets.SANDBOX_CLA_PR_TOKEN }}
fork-token: ${{ secrets.SANDBOX_CLA_FORK_TOKEN }}
# GitHub flavored markdown reinvents how paragraphs work, adjoined lines of text are not
# concatenated so instead we rely on YAML multi-line + extra newlines
comment-blurb: >-
> [!WARNING]

> This is a test of the CLA system. Review for correctness but otherwise ignore this comment.


# required check
analyze:
needs: [pytest, read-file, template-files]
needs: [pytest, read-file, template-files, check-cla]
if: '!cancelled()'
runs-on: ubuntu-latest
steps:
- name: Determine Success
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
id: alls-green
with:
# permit jobs to be skipped when triggered by a non-pull request event
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}

- name: Checkout our source
Expand Down
58 changes: 21 additions & 37 deletions check-cla/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,37 @@
A custom GitHub action to be used in the conda GitHub organization for checking the
conda contributor license agreement.

## GitHub Action Usage

In your GitHub repository include the action in your workflows:
## Action Inputs

| Name | Description | Default |
| ---- | ----------- | ------- |
| `label` | Label to apply to contributor's PR once the CLA is signed. | `cla-signed` |
| `repository` | Repository in which to create PR adding CLA signature. | `conda/cla` |
| `path` | Path to the CLA signees file within the provided `repository`. | `.cla-signers` |
| `magic-command` | Magic word to trigger the action via a comment. | `@conda-bot check` |
| `author` | Git-format author to use for the CLA commits. | @conda-bot |
| `token` | GitHub token to comment on PRs, change PR labels, and modify the commit status in the current repository.<br>Fine-grained PAT: `pull_request: write; statuses: write` | `${{ github.token }}` |
| `pr-token` | GitHub token to create pull request in the `repository`.<br>Fine-grained PAT: `pull_request: write` | `${{ inputs.token }}` |
| `fork-token` | GitHub token to create and push to a `repository` fork.<br>Fine-grained PAT: `administration: write; contents: write` | `${{ inputs.pr-token }}` |
| `contributor-id` | Contributor ID to check for CLA signature. | `${{ github.event.pull_request.user.id || github.event.issue.user.id }}` |
| `contributor-login` | Contributor login to check for CLA signature. | `${{ github.event.pull_request.user.login || github.event.issue.user.login }}` |
| `commit-status-context` | Commit status label/identifier. | `CLA check` |
| `comment-blurb` | Additional comment to add to PRs for contributors who have not signed the CLA. | |

## Sample Workflows

```yaml
name: Check CLA

on:
issue_comment:
types: [created]
pull_request_target:

jobs:
check:
if: >-
(
github.event.comment.body == '@conda-bot check'
&& github.event.issue.pull_request
|| github.event_name == 'pull_request_target'
)
steps:
- uses: conda/actions/check-cla
with:
# [required]
# A token with ability to comment, label, and modify the commit status
# (`pull_request: write` and `statuses: write` for fine-grained PAT; `repo` for classic PAT)
# (default: secrets.GITHUB_TOKEN)
token:
# [required]
# Label to apply to contributor's PR once CLA is signed
label:

# Upstream repository in which to create PR
# (default: conda/infrastructure)
cla_repo:
# Path to the CLA signees file within the provided `cla_repo`
# (default: .clabot)
cla_path:

# Fork of cla_repo in which to create branch
# (default: conda-bot/infrastructure)
cla_fork:
# [required]
# Token for opening signee PR in the provided `cla_repo`
# (`pull_request: write` for fine-grained PAT; `repo` and `workflow` for classic PAT)
cla_token:
# Git-format author/committer to use for pull request commits
# (default: Conda Bot <[email protected]>)
cla_author:
token: ...
pr-token: ...
fork-token: ...
```
Loading
Loading