From 4d9210a707bfcabe4b17573bbc7c5e61d1b42549 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Mon, 6 Jul 2026 09:18:36 -0400 Subject: [PATCH] Fixing PR parsing. --- action.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index 9405536..5b9b143 100644 --- a/action.yml +++ b/action.yml @@ -16,7 +16,7 @@ inputs: tea-version: description: Tea CLI version - default: 0.10.1 + default: 0.14.2 pr-title: description: Custom title. Defaults to using subject of the most recent commit. @@ -81,15 +81,16 @@ runs: shell: bash continue-on-error: true run: | - echo "Checking for PR... 🔎" pr_number=$(tea pr list \ - --repo ${{ github.repository }} \ - --state open \ - --fields index,head \ - --output simple \ - | egrep "${{ github.ref_name }}" \ - | awk '{print $1}'\ - | tr -d '#') + --repo ${{ github.repository }} \ + --state open \ + --fields index,head \ + --output simple \ + | egrep "${{ github.ref_name }}" \ + | grep -oE '#[0-9]+' \ + | head -n1 \ + | tr -d '#') + echo "pr_number=$pr_number" >> $GITHUB_OUTPUT - name: Skip PR Creation @@ -140,10 +141,16 @@ runs: -a "${{ inputs.assignee }}" \ -L "${{ inputs.pr-label }}" \ --output simple \ - | grep -m1 '#' \ - | awk '{print $1}' \ + | grep -oE '#[0-9]+' \ + | head -n1 \ | tr -d '#') + if [[ -z "${created_pr_index}" || "${created_pr_index}" != [0-9]* ]]; then + echo "::error::Could not parse created PR index from tea output" + exit 1 + fi + + created_pr_url="${{ inputs.url }}/${{ github.repository }}/pulls/${created_pr_index}" pr_comments_url="${{ inputs.url }}/api/v1/repos/${{ github.repository }}/issues/${created_pr_index}/comments"