From ef24bb97e51a675d9902e06f6108551550d48d16 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Wed, 15 Jan 2025 12:10:52 -0500 Subject: [PATCH] . --- .gitea/workflows/deployment.yml | 41 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/deployment.yml b/.gitea/workflows/deployment.yml index 850ac4c0..4527e260 100644 --- a/.gitea/workflows/deployment.yml +++ b/.gitea/workflows/deployment.yml @@ -20,27 +20,36 @@ jobs: uri: 'https://gitea.com/gitea/tea/releases/download/v0.9.2/tea-0.9.2-linux-amd64' name: 'tea' version: '0.9.2' - - - name: Check if PR exists & Create - id: list-prs + + - name: Check opened PR + id: check-opened-pr-step + uses: sogoagain/check-opened-pr-action@v0.1 + + - name: Create PR... + if: steps.check-opened-pr-step.outputs.exists == 'false' run: | tea login add --name gitea-rinoa --url ${{ secrets.RINOA_GITEA_URL }} --user gitea-sonarqube-bot --password "${{ secrets.BOT_GITEA_PASSWORD }}" --token ${{ secrets.BOT_GITEA_TOKEN }} tea login default gitea-rinoa + echo "Creating PR for branch: ${{ github.ref_name }}" + pr_index_recent=$(tea pr ls --state all --fields index --output csv | sed -e 's|"||g' | head -2 | tail -1) + pr_index_new=$((pr_index + 1)) + echo "PR index: $pr_index" + tea pr c -r ${{ github.repository }} -t "Automated PR for ${{ github.ref_name }} - ${pr_index_new}" --body "Automatically created PR for branch: ${{ github.ref_name }}" - echo "Checking if any open PRs exist for branch: ${{ github.ref_name }}" - PR_STATE=$(tea pr ls --repo "${{ github.repository }}" --state all --fields index,title,head,state --output csv | grep "${{ github.ref_name }}") | head -1 | awk -F',' '{print $4}' | tr -d '"' - echo "PR_STATE: $PR_STATE" - PR_EXISTS=$(echo "$PR_STATE" | wc -l) + # echo "Checking if any open PRs exist for branch: ${{ github.ref_name }}" + # PR_STATE=$(tea pr ls --repo "${{ github.repository }}" --state all --fields index,title,head,state --output csv | grep "${{ github.ref_name }}") | head -1 | awk -F',' '{print $4}' | tr -d '"' + # echo "PR_STATE: $PR_STATE" + # PR_EXISTS=$(echo "$PR_STATE" | wc -l) - if [ "$PR_EXISTS" -ge 1 ]; then - echo "PR exists, skipping creation..." - elif [ "$PR_EXISTS" -eq 0 ]; then - echo "PR does not exist, creating PR..." - tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }}" - else - echo "Error determining PR status. Exiting..." - exit 1 - fi + # if [ "$PR_EXISTS" -ge 1 ]; then + # echo "PR exists, skipping creation..." + # elif [ "$PR_EXISTS" -eq 0 ]; then + # echo "PR does not exist, creating PR..." + # tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }}" + # else + # echo "Error determining PR status. Exiting..." + # exit 1 + # fi docker-compose-test: name: Docker Compose Test