From a7e3427e2c55aa17d95ec073803bf36ff906ee08 Mon Sep 17 00:00:00 2001 From: Vladimir Portnov Date: Fri, 15 Nov 2024 15:46:53 +0800 Subject: [PATCH] test --- .../on-pull-request-backport.yml | 20 ++++++++++++++++++- .../workflows/on-pull-request-backport.yml | 20 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflow_templates/on-pull-request-backport.yml b/.github/workflow_templates/on-pull-request-backport.yml index ba36b7e873..7951172a94 100644 --- a/.github/workflow_templates/on-pull-request-backport.yml +++ b/.github/workflow_templates/on-pull-request-backport.yml @@ -26,6 +26,24 @@ on: - created jobs: + conditions: + name: Check conditions + runs-on: ubuntu-latest + outputs: + trigger_by_label: ${{steps.check.outputs.trigger_by_label}} + trigger_by_comment: ${{steps.check.outputs.trigger_by_comment}} + steps: + - name: Check conditions for backport + id: check + uses: {!{ index (ds "actions") "actions/github-script" }!} + with: + script: | + console.log(context); + if (!context.payload.comment.body.startsWith('/')) { + core.notice(`Ignore regular comment.`); + return; + } + detect_pr_by_label: concurrency: source_pr if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.milestone != null && contains(github.event.pull_request.labels.*.name, 'status/backport') }} @@ -128,7 +146,7 @@ jobs: committer: "deckhouse-BOaTswain <89150800+deckhouse-boatswain@users.noreply.github.com>" branch: ${{ env.RELEASE_BRANCH }} commit: ${{ env.COMMIT_SHA }} - labels: auto,status/backport/success + labels: auto,backported automerge: true merge_method: squash - name: Add success label diff --git a/.github/workflows/on-pull-request-backport.yml b/.github/workflows/on-pull-request-backport.yml index edf9cb9044..f7d296a98e 100644 --- a/.github/workflows/on-pull-request-backport.yml +++ b/.github/workflows/on-pull-request-backport.yml @@ -30,6 +30,24 @@ on: - created jobs: + conditions: + name: Check conditions + runs-on: ubuntu-latest + outputs: + trigger_by_label: ${{steps.check.outputs.trigger_by_label}} + trigger_by_comment: ${{steps.check.outputs.trigger_by_comment}} + steps: + - name: Check conditions for backport + id: check + uses: actions/github-script@v6.4.1 + with: + script: | + console.log(context); + if (!context.payload.comment.body.startsWith('/')) { + core.notice(`Ignore regular comment.`); + return; + } + detect_pr_by_label: concurrency: source_pr if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.milestone != null && contains(github.event.pull_request.labels.*.name, 'status/backport') }} @@ -132,7 +150,7 @@ jobs: committer: "deckhouse-BOaTswain <89150800+deckhouse-boatswain@users.noreply.github.com>" branch: ${{ env.RELEASE_BRANCH }} commit: ${{ env.COMMIT_SHA }} - labels: auto,status/backport/success + labels: auto,backported automerge: true merge_method: squash - name: Add success label