Note
Open Waters maintains this fork for its own repositories. It follows iainmcgin/cla-github-action, based on the archived contributor-assistant/github-action. The Apache-2.0 license and upstream Git history are preserved.
Consumers must pin a reviewed commit SHA. Open Waters owns dependency updates, security fixes, and the committed JavaScript bundle. Upstream changes are reviewed before adoption. CHANGELOG.md records the upstream changes.
For the protected-main integration, follow the Open Waters CLA setup. It runs without pull_request_target: a secret-free pull_request workflow triggers a workflow_run workflow that checks the pull request and reports a cla commit status on its head (the status-context and head-sha inputs).
Use Node 24. Run npm ci --ignore-scripts, npm run lint, npm test -- --runInBand, and npm run build. Commit the resulting dist/ files with source changes. CI rebuilds the action and rejects a bundle that differs from the committed files. The historical regression tests need a full Git checkout.
Dependency update PRs also need a local rebuild and a committed dist/ update before they can pass CI. This is a manual review step; workflows do not commit code on Dependabot's behalf.
Streamline your workflow and let this GitHub Action (a lite version of CLA Assistant) handle the legal side of contributions to a repository for you. CLA assistant GitHub action enables contributors to sign CLAs from within a pull request. With this GitHub Action we could get rid of the need for a centrally managed database by storing the contributor's signature data in a decentralized way - in the same repository's file system or in a remote repository which can be even a private repository.
- decentralized data storage
- fully integrated within github environment
- no User Interface is required
- contributors can sign the CLA or DCO by just posting a Pull Request comment
- signatures will be stored in a file inside the repository or in a remote repository
- signatures can also be stored inside a private repository
- versioning of signatures
name: "CLA Assistant"
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened,closed,reopened,synchronize]
# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
permissions:
actions: write
contents: write # this can be 'read' if the signatures are in remote repository
pull-requests: write
statuses: write
jobs:
CLAAssistant:
runs-on: ubuntu-latest
steps:
- name: "CLA Assistant"
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
# Pin to a full 40-character commit SHA, not a tag — see "Pinning by commit SHA" below.
uses: openwatersio/cla-github-action@0d27e5a16278d4adb6b0c4b92f08ad27b0a21dc8 # upstream v3.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# the below token should have repo scope and must be manually added by you in the repository's secret
# This token is required only if you have configured to store the signatures in a remote repository/organization
# PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
path-to-signatures: 'signatures/version1/cla.json'
path-to-document: 'https://link/to/your/cla-or-dco/document' # e.g. a CLA or a DCO document
# branch should not be protected
branch: 'main'
allowlist: user1,*[bot]
# the followings are the optional inputs - If the optional inputs are not given, then default values will be taken
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
#signed-commit-message: 'For example: $contributorName has signed the CLA in $owner/$repo#$pullRequestNo'
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
#use-dco-flag: true - If you are using DCO instead of CLA
#require-opener-as-author: false - if your workflow involves submitters legitimately opening PRs containing only commits authored by others (cherry-picks, release engineering). Default is true.
Important
Pinning by commit SHA
The uses: line above references this action by its full 40-character commit
SHA, not by a version tag like @v3.0.0. This is intentional and strongly
recommended for all third-party GitHub Actions.
Git tags are mutable: a maintainer (or a compromised maintainer account) can
retarget v3.0.0 to a different commit at any time, silently changing what
code runs in your CI with full access to GITHUB_TOKEN. A commit SHA is
content-addressed and immutable — once you have audited the code at that SHA,
it cannot change underneath you. See
Why you should pin GitHub Actions by commit hash
and GitHub's own
security hardening guide
for the full rationale.
To find the SHA to pin to:
# Latest commit on master:
git ls-remote https://github.com/openwatersio/cla-github-action.git refs/heads/masterOr browse to the releases page or commits page, pick a commit, and copy the full SHA. After pinning, add the human-readable reference as a trailing comment so future readers know what they're looking at:
uses: openwatersio/cla-github-action@0d27e5a16278d4adb6b0c4b92f08ad27b0a21dc8 # upstream v3.2.0Tools like Dependabot and Renovate understand this format and will open PRs to bump the SHA when a newer commit is available, preserving the comment.
CLA action workflow will be triggered on all Pull Request opened, closed, reopened, synchronize. This workflow will always run in the base repository and that's why we are making use of the pull_request_target event.
When the CLA workflow is triggered on pull request closed event and the Pull Request was merged, it will lock the Pull Request conversation so that the contributors cannot modify or delete the signatures (Pull Request comment) later. This feature is optional. On a reopened event, the action removes a conversation lock it left behind (older versions locked Pull Requests that were closed without merging), so the CLA check can comment again.
CLA workflow creates a comment on Pull Request asking contributors who have not signed CLA to sign and also fails the pull request status check with a failure. The contributors are requested to sign the CLA within the pull request by copy and pasting "I have read the CLA Document and I hereby sign the CLA" as a Pull Request comment like below.
If the contributor has already signed the CLA, then the PR status will pass with success.
After the contributor signed a CLA, the contributor's signature with metadata will be stored in a JSON file inside the repository and you can specify the custom path to this file with path-to-signatures input in the workflow.
The default path is path-to-signatures: 'signatures/version1/cla.json'.
The signature can be also stored in a remote repository which can be done by enabling the optional inputs remote-organization-name: <your org name>
and remote-repository-name: <your repo name> in your CLA workflow file.
NOTE: You do not need to create this file manually. Our workflow will create the signature file if it does not already exist. Manually creating this file will cause the workflow to fail.
An allowlisted GitHub username does not need to sign the CLA. Set comma-separated logins such as dependabot[bot],greenkeeper[bot], or use *[bot] for bot login suffixes. Wildcards match the whole login, name, or email address: bot* matches only values starting with bot. Email exemptions apply to commit credits; the authenticated human PR opener must still sign unless their login is exempt. The authorship guard is a separate check from the signing exemption.
You have to create a Repository Secret with the name PERSONAL_ACCESS_TOKEN.
This PAT should have repo scope and is only required if you have configured to store the signatures in a remote repository/organization.
| Name | Requirement | Description |
|---|---|---|
GITHUB_TOKEN |
required | Usage: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}, CLA Action uses this in-built GitHub token to make the API calls for interacting with GitHub. It is built into Github Actions and does not need to be manually specified in your secrets store. More Info |
PERSONAL_ACCESS_TOKEN |
required | Usage: PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN}}, you have to create a Personal Access Token with repo scope and store in the repository's secrets. |
| Name | Requirement | Description | Example |
|---|---|---|---|
path-to-document |
required | provide full URL https://<clafile> to the document which shall be signed by the contributor(s) It can be any file e.g. inside the repository or it can be a gist. |
https://github.com/cla-assistant/github-action/blob/master/SAPCLA.md |
path-to-signatures |
optional | Path to the JSON file where all the signatures of the contributors will be stored inside the repository. | signatures/version1/cla.json |
branch |
optional | Branch in which all the signatures of the contributors will be stored and Default branch is master. |
master |
allowlist |
optional | Comma-separated account logins, names, or email addresses. * matches within the whole value; bot* matches a value starting with bot. |
user1,user2,*[bot] |
remote-repository-name |
optional | provide the remote repository name where all the signatures should be stored . | remote repository name |
remote-organization-name |
optional | provide the remote organization name where all the signatures should be stored. | remote organization name |
create-file-commit-message |
optional | Commit message when a new CLA file is created. | Creating file for storing CLA Signatures. |
signed-commit-message |
optional | Commit message when a new contributor signs the CLA in a Pull Request. | $contributorName has signed the CLA in $pullRequestNo |
custom-notsigned-prcomment |
optional | Introductory Pull Request comment to ask new contributors to sign. | Thank you for your contribution and please kindly read and sign our $pathToCLADocument |
custom-pr-sign-comment |
optional | The signature to be committed in order to sign the CLA. | I have read the Developer Terms Document and I hereby accept the Terms |
custom-allsigned-prcomment |
optional | pull request comment when everyone has signed | All Contributors have signed the CLA. |
lock-pullrequest-aftermerge |
optional | Boolean input for locking the pull request after merging. Default is set to true. It is highly recommended to lock the Pull Request after merging so that the Contributors won't be able to revoke their signature comments after merge |
false |
suggest-recheck |
optional | Boolean input for indicating if the action's comment should suggest that users comment recheck. Default is set to true. |
false |
use-dco-flag |
optional | Boolean input. Set to true to run the action in DCO (Developer Certificate of Origin) mode instead of CLA mode. The bot's prompts and persistence logic use DCO wording. Default is false. |
true |
require-opener-as-author |
optional | Boolean input. When true (the default), fail the check if the Pull Request opener is not recorded as an author or co-author of any commit. Guards against an attacker opening a PR whose commits are attributed to an identity they do not control. Set to false for workflows that legitimately involve submitting commits authored by others (cherry-picks, release-engineering patch submission, mailing-list-style contribution). |
false |
status-context |
optional | Report the result as a commit status with this context on the pull request's head commit, for workflow_run and issue_comment workflows, which run on the base repository and cannot report on the pull request through their own job. Signing by comment then updates the status instead of rerunning a workflow. An unsigned result fails only the status, not the job, and conversation locking does not run. Needs statuses: write. |
cla |
head-sha |
optional | With status-context, check the open pull request whose head is this commit. Required with status-context on every event except issue_comment. When several open pull requests share the head, the status is error. |
${{ github.event.workflow_run.head_sha }} |
| Name | Description |
|---|---|
opener_not_in_commits |
Set to 'true' when the Pull Request opener is not recorded as an author or co-author of any commit in the PR. Emitted regardless of whether require-opener-as-author caused the check to fail. |
The following list credits contributors to the upstream projects.
Contributor License Agreement assistant
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.




