Skip to content

Commit

Permalink
Skip comments on issues
Browse files Browse the repository at this point in the history
The bot is currently triggered for comments on both issues and pull
requests, but the bot has no purpose on issues. If the job does end
up getting run, it will fail with an error.

The example in the README has been updated to skip the job when
triggered by issue comments. The runner will also bail early if it
determines that it's being run for an issue comment rather than a pull
request comment, instead of blowing up when it tries to get the pull
request authors.

Fixes Roblox#10
  • Loading branch information
Gudahtt committed Aug 26, 2020
1 parent 2669f06 commit 6595ecd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ on:

jobs:
CLABot:
# Skip job when triggered by an issue comment rather than a PR comment
if: github.event_name == 'pull_request_target' || contains(github.event.comment.html_url, '/pull/')
runs-on: ubuntu-latest
steps:
- name: "CLA Signature Bot"
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/claRunner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as core from '@actions/core';
import { context } from "@actions/github";
import { Author } from "./authorMap";
import { BlockchainPoster } from "./blockchainPoster";
import { ClaFileRepository } from "./claFileRepository";
Expand Down Expand Up @@ -47,6 +48,9 @@ export class ClaRunner {
// PR is closed and should be locked to preserve signatures.
await this.lockPullRequest();
return true;
} else if (this.settings.payloadAction === "issue_comment" && !context.payload.issue?.pull_request) {
core.info("Skipping issue comment")
return true
}

// Just drop allowlisted authors entirely, no sense in processing them.
Expand Down

0 comments on commit 6595ecd

Please sign in to comment.