From e1ba24591b42dc05197f299029e2e216d4cbf3da Mon Sep 17 00:00:00 2001 From: Joshua Schmid Date: Fri, 24 Nov 2023 09:40:55 +0100 Subject: [PATCH 1/3] fix: change condition to start a backport by label the `contains` expression can lead to unexpected action boot-loops when the error itself contains `/backport`. This can be the case when a branch is includes the name "backport". for example in a comment like this ``` error message .. in branch origin/backport-form-xx-to-xx ``` Using `startsWith` to reduce the likeliness of this issue. https://docs.github.com/en/actions/learn-github-actions/expressions#startswith --- .github/workflows/backport.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 04ccdbd..6122541 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -21,9 +21,9 @@ jobs: ) || ( github.event_name == 'issue_comment' && github.event.issue.pull_request && - contains(github.event.comment.body, '/backport') + startsWith(github.event.comment.body, '/backport') ) steps: - uses: actions/checkout@v4 - name: Create backport pull requests - uses: korthout/backport-action@v2 \ No newline at end of file + uses: korthout/backport-action@v2 From f067bf0a5d037a1b5fb4cad6ad15d4c0bd6f1ead Mon Sep 17 00:00:00 2001 From: Nico Korthout Date: Fri, 24 Nov 2023 15:55:37 +0100 Subject: [PATCH 2/3] docs: align comment with condition --- .github/workflows/backport.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 6122541..c2db972 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest # Only run when pull request is merged - # or when a comment containing `/backport` is created + # or when a comment starting with `/backport` is created if: > ( github.event_name == 'pull_request' && From 197149d0b76f8c648d925314763e2c2a01a08613 Mon Sep 17 00:00:00 2001 From: Nico Korthout Date: Fri, 24 Nov 2023 15:56:36 +0100 Subject: [PATCH 3/3] docs: only start backport by comment starting with the `contains` expression can lead to unexpected action boot-loops when the error itself contains `/backport`. This can be the case when a branch is includes the name "backport". for example in a comment like this ``` error message .. in branch origin/backport-form-xx-to-xx ``` Using `startsWith` to reduce the likeliness of this issue. https://docs.github.com/en/actions/learn-github-actions/expressions#startswith --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 65891be..bbb4b93 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ jobs: runs-on: ubuntu-latest # Only run when pull request is merged - # or when a comment containing `/backport` is created by someone other than the + # or when a comment starting with `/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: > @@ -90,7 +90,7 @@ jobs: github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.comment.user.id != 97796249 && - contains(github.event.comment.body, '/backport') + startsWith(github.event.comment.body, '/backport') ) steps: - uses: actions/checkout@v4