From 089796d2011cf9adae25e5f5ad735c4896bdb880 Mon Sep 17 00:00:00 2001 From: MarvinF Date: Tue, 24 Jun 2025 22:37:05 +0200 Subject: [PATCH] Create autolabel.yaml --- .github/workflows/autolabel.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/autolabel.yaml diff --git a/.github/workflows/autolabel.yaml b/.github/workflows/autolabel.yaml new file mode 100644 index 0000000..bec469a --- /dev/null +++ b/.github/workflows/autolabel.yaml @@ -0,0 +1,31 @@ +name: Auto-label PRs + +on: + pull_request: + types: [opened, reopened, synchronize, edited] + +jobs: + label-stage-to-prod: + runs-on: ubuntu-latest + steps: + - name: Label PRs + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const base = context.payload.pull_request.base.ref; + const head = context.payload.pull_request.head.ref; + + if (base === 'sportsmanager2-prod' && head === 'sportsmanager2-stage') { + await github.rest.issues.addLabels({ + ...context.repo, + issue_number: context.payload.pull_request.number, + labels: ['prod-merge'] + }); + } else if (base === 'sportsmanager2-stage' && head === 'sportsmanager2-dev') { + await github.rest.issues.addLabels({ + ...context.repo, + issue_number: context.payload.pull_request.number, + labels: ['stage-merge'] + }); + }