Skip to content

Commit

Permalink
Add logs about limitations related to pull_request events and forks
Browse files Browse the repository at this point in the history
See #13
  • Loading branch information
samuelmeuli committed Feb 27, 2020
1 parent 201562c commit d965826
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ async function runAction() {
const autoFix = getInput("auto_fix") === "true";
const commitMsg = getInput("commit_message", true);

// If on a PR from fork: Display messages regarding action limitations
if (context.eventName === "pull_request" && context.repository.hasFork) {
log(
"This action does not have permission to create annotations on forks. You may want to run it only on `push` events. See https://github.com/samuelmeuli/lint-action/issues/13 for details",
"error",
);
if (autoFix) {
log(
"This action does not have permission to push to forks. You may want to run it only on `push` events. See https://github.com/samuelmeuli/lint-action/issues/13 for details",
"error",
);
}
}

if (autoFix) {
// Set Git committer username and password
git.setUserInfo(GIT_NAME, GIT_EMAIL);
Expand Down

0 comments on commit d965826

Please sign in to comment.