From 188bf0c4dab4cd63059cc2ecbb38d37da4098bfe Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 14 Jan 2025 12:19:41 -0500 Subject: [PATCH 1/2] Tweaking PR creation step. --- .gitea/workflows/deployment.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/deployment.yml b/.gitea/workflows/deployment.yml index 48558d79..f5ec0207 100644 --- a/.gitea/workflows/deployment.yml +++ b/.gitea/workflows/deployment.yml @@ -28,13 +28,19 @@ jobs: tea login default gitea-rinoa echo "Checking if PR exists for ${{ github.ref_name }}" tea pr ls --repo ${{ github.repository }} --state open --fields index,title,head,state - pr_state=$(tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head,state --output csv | egrep '${{ gitea.ref_name }}' | head -1 |awk -F, '{print $4}' | sed -e 's|"||g') - echo "PR state: ${pr_state}" - if [ "${pr_state}" != 'open' ]; then + tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head,state --output csv | egrep -q '${{ gitea.ref_name }}' + if [ $? -eq 0 ]; then + echo "PR exists, checking state..." + pr_state=$(tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head,state --output csv | egrep '${{ github.ref_name }}' | awk -F',' '{print $4}') + if [ "${pr_state}" != 'open' ]; then + echo "PR does not exist, creating..." + tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }}" + elif [ "${pr_state}" = 'open' ]; then + echo "PR already exists, skipping creation..." + fi + elif [ $? -eq 1 ]; then echo "PR does not exist, creating..." - tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }}" - elif [ "${pr_state}" = 'open' ]; then - echo "PR already exists, skipping creation..." + tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }} fi docker-compose-test: From bfcac1b0e1f7cbb70d02389530eee991327cec00 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Tue, 14 Jan 2025 12:21:05 -0500 Subject: [PATCH 2/2] Tweaking PR creation step. --- .gitea/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/deployment.yml b/.gitea/workflows/deployment.yml index f5ec0207..963d3687 100644 --- a/.gitea/workflows/deployment.yml +++ b/.gitea/workflows/deployment.yml @@ -40,7 +40,7 @@ jobs: fi elif [ $? -eq 1 ]; then echo "PR does not exist, creating..." - tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }} + tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }}" fi docker-compose-test: