From 0a7bed66ea76d2ded5126076080e97c3b75dd385 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Wed, 14 May 2025 15:19:59 +0200 Subject: [PATCH] Workflows --- .github/workflows/delete_new_script.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/delete_new_script.yaml b/.github/workflows/delete_new_script.yaml index d938ea5..36f04a8 100644 --- a/.github/workflows/delete_new_script.yaml +++ b/.github/workflows/delete_new_script.yaml @@ -14,6 +14,13 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} + - name: Generate a token for PR approval and merge + id: generate-token-merge + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.APP_ID_APPROVE_AND_MERGE }} + private-key: ${{ secrets.APP_KEY_APPROVE_AND_MERGE }} + - name: Extract Issue Title (Lowercase & Underscores) id: extract_title run: echo "TITLE=$(echo '${{ github.event.issue.title }}' | tr '[:upper:]' '[:lower:]' | sed 's/ /_/g')" >> $GITHUB_ENV @@ -72,6 +79,19 @@ jobs: #gh pr merge $pr_number --squash echo pr_number=$pr_number >> $GITHUB_ENV + - name: Approve pull request and merge + if: env.changed == 'true' + env: + GH_TOKEN: ${{ steps.generate-token-merge.outputs.token }} + run: | + git config --global user.name "github-actions-automege[bot]" + git config --global user.email "github-actions-automege[bot]@users.noreply.github.com" + PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number') + if [ -n "$PR_NUMBER" ]; then + gh pr review $PR_NUMBER --approve + gh pr merge $PR_NUMBER --squash --admin + fi + - name: Comment on Issue uses: actions/github-script@v7 with: