Giter Site home page Giter Site logo

roblox / cla-signature-bot Goto Github PK

View Code? Open in Web Editor NEW
14.0 7.0 13.0 19.1 MB

GitHub Action for self-contained handling of CLA signatures

License: Apache License 2.0

TypeScript 99.67% JavaScript 0.33%
action contributor-license-agreement roblox

cla-signature-bot's Introduction

Contributor License Agreement Signature GitHub Action

build

A GitHub Action for GitHub-native automated handling of contributor license agreement signatures. This action enables developers to self-sign a CLA without having to run external services for a separate system. The Action handles logic and stores signatures either in the same repository being protected or in a central repository that all protected projects can read and write signatures from.

Features

  1. (De)-Centralized Signature Storage, choose whether repositories store signatures independently or use one central signature file.
  2. Fully integrated GitHub Action, no external services required.
  3. No dedicated UI, simply uses comments in Pull Requests.
  4. Contributors can sign the CLA by just posting a Pull Request comment.
  5. Signatures will be stored in a file for auditing.
  6. Optionally store signatures on the Ethereum Blockchain.

Signatures are stored in an easy-to-parse JSON structure either in the same repo running the GitHub Action or in an alternate repo that you can configure.

Screenshot 2020-01-07 at 16 13 43

Configure CLA Signature Action in two minutes

Add the following Workflow File to your repository in the path .github/workflows/cla.yml

name: "CLA Signature Bot"
on:
  issue_comment:
    types: [created]
  pull_request:
    types: [opened,closed,synchronize]

jobs:
  CLABot:
    runs-on: ubuntu-latest
    steps:
      - name: "CLA Signature Bot"
        uses: roblox/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          path-to-signatures: 'signatures/version1/cla.json'
          url-to-cladocument: 'https://link/to/your/legal/CLA/document/of/choice'
          # This branch can't have protections, commits are made directly to the specified branch.
          branch: 'master'
          whitelist: githubuser_example,anotherGitHubuser,bot
          blockchain-storage-flag: false

Open a new pull request

CLA action workflow will be triggered on all Pull Request opened, synchronize, closed.

When the CLA workflow is triggered on pull request closed event, it will lock the Pull Request conversation after the Pull Request merge so that the contributors cannot modify or delete the signature comments later.

If your signature is not on file and your account isn't in the whitelist, the CLA Bot will provide instructions on what to do in the PR Conversation and block the PR from merging until all authors of commits sign the CLA.

Screenshot 2020-02-13 at 10 24 17

Sign the CLA

The CLA Signature Action will comment on the pull request asking for authors to sign the CLA. Commit authors will then need to use their GitHub accounts to write "I have read the CLA Document and I hereby sign the CLA" in the Pull Request comments to sign the CLA.

Add a comment with the requested signature to your pull request to sign the CLA. The action will execute again and automatically mark your signature in the CLA signatures file. When all authors have signed the CLA the PR check will pass.

Additional Configuration Options

Whitelist Accounts

The whitelist parameter is a comma-seprated list of accounts which should not be considered for CLA signature verification. These accounts will completely bypass the signature process, and if all authors are whitelisted in a PR the CLA Signature Action won't even comment on the PR.

This feature is particularly useful for other bot accounts, such as dependabot or greenkeeper. For example, dependabot-preview[bot],greenkeeper[bot] will whitelist both of those bot accounts.

Wildcards are accepted and will be treated as a regex .* character, so you can whitelist ranges of accounts. Use caution with wildcards to avoid whitelisting actual human contributors.

Some common accounts you may want to whitelist:

  • dependabot[bot] - This is the account GitHub will use to open Dependabot fixes on your account.
  • Your personal account - Since you'll be opening the PR to add it you'll need to either sign the CLA or just add yourself to the whitelist.

Using the Ethereum Blockchain

The CLA Signature Bot has the option to additionally store the signatures on the Ethereum Blockchain. To use this feature just set the blockchain-storage-flag: true. A detailed description on integrating with the Ethereum Blockchain can be found here. The original implementation of this feature is thanks to @FabianRiewe.

Full list of configuration options

Environment Variables (env: yaml section)

Name Requirement Description
GITHUB_TOKEN Required Used for interacting with the local repository, such as adding comments to PRs. Does not need to be manually specified in Repository Secrets, read more. Must be in the form of GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Inputs (with: yaml section)

Name Requirement Description
url-to-cladocument Required The full URL of your CLA document. The CLA bot will link to this document in a Pull Request comment, so make sure it's public. Could be a gist link, or a link to a file in the same repo.
path-to-signatures optional Path to the signature file in the repository. Default is ./signatures/cla.json.
branch optional Repository branch to store the signature file. Default is master
whitelist optional Comma-separated list of accounts to ignore. Example: user1,user2,bot*
blockchain-storage-flag optional Whether to store the Contributor's signature data in the Ethereum blockchain. May be true or false. Default is false.
blockchain-webhook-endpoint optional The URL to post the blockchain request to. Can be used when running your own blockchain-services docker container.
use-remote-repo optional Whether to use an alternate repository for storing the signature file than the one running the workflow. If true the remote repo name and PAT must be provided. Default is false.
remote-repo-name optional The name of the alternate repository to store the signature file. Must be in owner/repo-name format, ex: roblox/cla-assistant. Mandatory if use-remote-repo is true.
remote-repo-pat optional A Personal Access Token with permission to write to the remote repo. If the repo is private it must have repo:private scope. Mandatory if use-remote-repo is true.

License

Contributor License Agreement Signature Bot Copyright (c) 2020 Roblox Corporation. All rights reserved.

Licensed under the Apache License, Version 2.0.

Credits

Provided with โ™ฅ by Roblox.

This project is an extension of the original CLA-Assistant-Lite project created by SAP SE and especially Akshay Iyyadurai Balasundaram . Our thanks go out to them for the idea and initial implementation that was rewritten into this system. The original project can be found at https://github.com/cla-assistant/github-action.

cla-signature-bot's People

Contributors

alohr51 avatar cliffchapmanrbx avatar ibakshay avatar kushudai-zz avatar michael-spengler avatar rgychiu avatar scottbrenner avatar shunkakinoki avatar writhe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cla-signature-bot's Issues

Download Problem

Describe the bug
I try to use the CLA-Signature bot with the described configuration. The bot is started but cannot be downloaded. The error message is

Failed to resolve action download info. Error: Unable to resolve action `Roblox/[email protected]`, unable to find version `2.0.1`

I tried the following definitions for uses in the script:

To Reproduce
Steps to reproduce the behavior:

  1. Use the script as defined in https://github.com/Roblox/cla-signature-bot/blob/master/README.md
  2. In an existing issue on your repository, add a new comment
  3. Go to the Actions tab of your repository to see the error

Expected behavior
GitHub actions should be able to download the bot.

Log

Current runner version: '2.275.1'
Operating System
Virtual Environment
Prepare workflow directory
Prepare all required actions
Getting action download info
Failed to resolve action download info. Error: Unable to resolve action `Roblox/[email protected]`, unable to find version `2.0.1`
Retrying in 20.256 seconds
Failed to resolve action download info. Error: Unable to resolve action `Roblox/[email protected]`, unable to find version `2.0.1`
Retrying in 11.918 seconds
Error: Failed to resolve action download info.

Add GitHub App auth support

Currently the app needs a PAT (tied to a specific account) to perform auth for the remote repository. Modify this to allow for GitHub App auth instead, allowing the action to authenticate as an app. The app should only need repo read/write scopes to be able to read and write to the cla.json file in the remote repo, nothing more.

Improper handling of fork CLA checks

Describe the bug

When opening a fork-based PR the secret value for the remote repo PAT is not supplied for security reasons. This causes an error as that input is marked as required and it is blank.

To Reproduce

Open a PR from a fork.

Suggested fix:

Add a unit test for this situation as it should be handled gracefully. The remote repo should be anonymous-readable so that the PAT is not mandatory for read operations.

On the other hand, if we attempt to write to a remote repo while we lack a remote repo PAT we should fail.

Add support for teams

The current recommendation is that employees be added to the whitelist for the CLA bot, but this needs to be done for each employee for each repo. Some way to automate this would help a lot. Probably the simplest option would be to allow the bot to accept teams in its whitelist.

Centralized whitelist

It requires some duplicated effort to maintain an employee whitelist across many repositories in the same organization.

It would be great to support pulling the contributor whitelist from a central repository, perhaps the same repository that contains who has signed the CLA.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.