Skip to content

Commit

Permalink
Add 'repo_dir' argument to cla_check.py (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusTomlinson authored Mar 19, 2021
1 parent 4b3e162 commit 442a3a0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- name: Check if CLA signed
id: has_signed_cla
uses: canonical/[email protected].6
uses: canonical/[email protected].7
with:
username: ${{ github.event.pull_request.user.login }}
base_ref: ${{ github.base_ref }}
Expand Down
9 changes: 4 additions & 5 deletions cla_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
import argparse
from subprocess import check_call, check_output

# cd to script directory
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)

try:
from launchpadlib.launchpad import Launchpad
except ImportError:
Expand Down Expand Up @@ -122,10 +117,14 @@ def print_checkout_info(travis_commit_range):

def main():
parser = argparse.ArgumentParser(description="")
parser.add_argument(
"repo_dir", help="Repository directory"
)
parser.add_argument(
"commit_range", help="Commit range in format <upstream-head>..<fork-head>"
)
opts = parser.parse_args()
os.chdir(opts.repo_dir)
master, _ = opts.commit_range.split("..")
print_checkout_info(opts.commit_range)
emails = get_emails_for_range(opts.commit_range)
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ async function run() {
const base_sha = github.context.payload['pull_request']['base']['sha']
const head_sha = github.context.payload['pull_request']['head']['sha']

await exec.exec('cp cla_check.py repo/');
await exec.exec('python repo/cla_check.py ' + base_sha + '..' + head_sha)
await exec.exec('wget https://raw.githubusercontent.com/canonical/has-signed-canonical-cla/main/cla_check.py');
await exec.exec('python cla_check.py repo ' + base_sha + '..' + head_sha)
.then((result) => {
has_signed = true
}).catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "has-signed-canonical-cla",
"version": "1.0.6",
"version": "1.0.7",
"description": "This GitHub Action verifies whether or not a particular GitHub user has signed the Canonical Contributor Licence Agreement (https://ubuntu.com/legal/contributors).",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 442a3a0

Please sign in to comment.