From c6a86da88089850afbbd091338183c5eb734ebcf Mon Sep 17 00:00:00 2001 From: Yaron Kaikov Date: Tue, 12 Nov 2024 11:20:19 +0200 Subject: [PATCH] ./github/workflows/add-label-when-promoted.yaml: Run auto-backport only on default branch In #21496 (comment) ``` scylladbbot force-pushed the backport/21459/to-6.1 branch from 414691c to 59a4ccd Compare 2 days ago ``` Backport automation is triggered by push but should also start from the master branch (or enterprise branches from Enterprise). We need to verify it by checking the default branch. (cherry picked from commit 26ef84fcce66fcaef81a8b44c2cdc99bb29eb140) --- .github/workflows/add-label-when-promoted.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/add-label-when-promoted.yaml b/.github/workflows/add-label-when-promoted.yaml index 1aeb0d5a..e9291d0d 100644 --- a/.github/workflows/add-label-when-promoted.yaml +++ b/.github/workflows/add-label-when-promoted.yaml @@ -40,6 +40,7 @@ jobs: run: | git config --global user.name "GitHub Action" git config --global user.email "action@github.com" + git config --global merge.conflictstyle diff3 - name: Install dependencies run: sudo apt-get install -y python3-github python3-git - name: Run python script @@ -48,7 +49,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.AUTO_BACKPORT_TOKEN }} run: python .github/scripts/search_commits.py --commits ${{ github.event.before }}..${{ github.sha }} --repository ${{ github.repository }} --ref ${{ github.ref }} - name: Run auto-backport.py when promotion completed - if: github.event_name == 'push' + if: github.event_name == 'push' && github.ref == 'refs/heads/${{ env.DEFAULT_BRANCH }}' env: GITHUB_TOKEN: ${{ secrets.AUTO_BACKPORT_TOKEN }} run: python .github/scripts/auto-backport.py --repo ${{ github.repository }} --base-branch ${{ github.ref }} --commits ${{ github.event.before }}..${{ github.sha }}