From 7a141742d4961999ad5701003fa357f047f5d026 Mon Sep 17 00:00:00 2001 From: Remco Date: Wed, 22 Jun 2022 15:17:01 +0200 Subject: [PATCH] Workflow should not trigger on own comments (#244) The backport-action bot added comments to PRs contain "/backport". This could result in the backport workflow being triggered again, causing an infinite loop of backport messages. By checking the user id of the comment we can prevent comments from backport-action triggering the workflow. --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f4df30..b00f21c 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,9 @@ jobs: contents: write # so it can comment pull-requests: write # so it can create pull requests # Only run when pull request is merged - # or when a comment containing `/backport` is created + # or when a comment containing `/backport` is created by someone other than the + # https://github.com/backport-action bot user (user id: 97796249). Note that if you use your + # own PAT as `github_token`, that you should replace this id with yours. if: > ( github.event_name == 'pull_request' && @@ -106,6 +108,7 @@ jobs: ) || ( github.event_name == 'issue_comment' && github.event.issue.pull_request && + github.event.comment.user.id != 97796249 && contains(github.event.comment.body, '/backport') ) steps: