From 62e11285d5628dff5f67645d1c718e1276478ecb Mon Sep 17 00:00:00 2001 From: Kyle Adams Date: Tue, 2 Jul 2024 00:17:32 -0500 Subject: [PATCH] feat: support pull_request_target events (#52) --- README.md | 2 +- github_actions/run.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 95fd7fc..ad71dab 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ jobs: uses: opensource-nepal/commitlint@v1 ``` -> **_NOTE:_** commitlint GitHub Actions will only be triggered by "push" or "pull_request" events. +> **_NOTE:_** commitlint GitHub Actions will only be triggered by "push", "pull_request", or "pull_request_target" events. The difference between "pull_request" and "pull_request_target" is that "pull_request" is more secure for public repos while "pull_request_target" is necessary for private repos. #### GitHub Action Inputs diff --git a/github_actions/run.py b/github_actions/run.py index 1822bf7..24ee644 100644 --- a/github_actions/run.py +++ b/github_actions/run.py @@ -13,6 +13,7 @@ # Events EVENT_PUSH = "push" EVENT_PULL_REQUEST = "pull_request" +EVENT_PULL_REQUEST_TARGET = "pull_request_target" # Inputs INPUT_FAIL_ON_ERROR = "INPUT_FAIL_ON_ERROR" @@ -174,7 +175,7 @@ def main() -> None: if event.event_name == EVENT_PUSH: _handle_push_event(event) - elif event.event_name == EVENT_PULL_REQUEST: + elif event.event_name in {EVENT_PULL_REQUEST, EVENT_PULL_REQUEST_TARGET}: _handle_pr_event(event) elif event.event_name is None: sys.stdout.write("No any events, skipping\n")