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 6adffa5 commit db7e5b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
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
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 (!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 db7e5b1

Please sign in to comment.