From 4e65c97c5bf8b385b90840910d8558dd8ac2865d Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Sun, 2 Nov 2025 10:11:11 -0500 Subject: [PATCH] Adjustments for passing PR index in workflow. --- .gitea/workflows/auto-pr-tofu-plan.yml | 37 +++++--------------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/.gitea/workflows/auto-pr-tofu-plan.yml b/.gitea/workflows/auto-pr-tofu-plan.yml index 33f3c3c..80fa145 100644 --- a/.gitea/workflows/auto-pr-tofu-plan.yml +++ b/.gitea/workflows/auto-pr-tofu-plan.yml @@ -16,6 +16,8 @@ env: jobs: check-and-create-pr: name: Check and Create PR + outputs: + pr_number: ${{ steps.pr-check-create.outputs.pr_number }} runs-on: ubuntu-latest steps: - name: Checkout Code @@ -36,6 +38,7 @@ jobs: notification_message: "Checking for existing PR... 🔍" - name: PR Check/Creation + id: pr-check-create uses: https://git.trez.wtf/Trez/gitea-auto-pr@main with: url: ${{ secrets.TREZ_GITEA_URL }} @@ -67,34 +70,6 @@ jobs: version: ${{ env.OPENTOFU_VERSION }} tofu_wrapper: true - - name: Install tea - uses: supplypike/setup-bin@8e3f88b4f143d9b5c3497f0fc12d45c83c123787 # v4.0.1 - with: - uri: https://gitea.com/gitea/tea/releases/download/v${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64 - name: tea - version: ${{ env.TEA_VERSION }} - - - name: Extract PR Index - id: tea-pr-index - run: | - tea login add \ - --name gitea-rinoa \ - --url "${{ secrets.TREZ_GITEA_URL }}" \ - --user gitea-sonarqube-bot \ - --password "${{ secrets.BOT_GITEA_PASSWORD }}" \ - --token ${{ secrets.BOT_GITEA_TOKEN }} - - tea login default gitea-rinoa - - pr_number=$(tea pr list \ - --repo ${{ github.repository }} \ - --state open \ - --fields index,head \ - --output simple \ - | awk '{print $1}') - - echo "pr_number=$pr_number" >> "$GITHUB_OUTPUT" - - name: Generate .env from Hashicorp Vault uses: https://git.trez.wtf/Trez/hc-vault-env@main with: @@ -176,7 +151,7 @@ jobs: platform: gitea api_url: https://git.trez.wtf/api/v1 token: ${{ secrets.BOT_GITEA_TOKEN }} - pr_index: ${{ steps.tea-pr-index.outputs.pr_number }} + pr_index: ${{ needs.check-and-create-pr.outputs.pr_number }} repo_owner: ${{ github.repository_owner }} repo_name: ${{ steps.env-vault-vars.outputs.repo_name }} plan_file: cloudflare/cloudflare.tfplan @@ -193,15 +168,17 @@ jobs: # commenter_type: plan # commenter_input: ${{ steps.tofu_plan.outputs.plan-output }} # commenter_exitcode: ${{ steps.tofu_plan.outputs.exitcode }} + approval: name: Manual Approval - needs: plan + needs: [check-and-create-pr, plan] runs-on: ubuntu-latest steps: - name: Wait for manual approval uses: hmarr/auto-approve-action@v2 with: message: "Awaiting manual approval to apply Tofu plan" + pull-request-number: ${{ needs.check-and-create-pr.outputs.pr_number }} apply: name: Apply Tofu Plan