This commit is contained in:
2025-01-14 13:21:18 -05:00
parent caa15ed4ee
commit 01b4f58524
+3 -11
View File
@@ -27,19 +27,11 @@ jobs:
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 "Checking if PR exists for ${{ github.ref_name }}..."
tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head,state --output csv | egrep -q '${{ github.ref_name }}'
tea pr ls --repo ${{ github.repository }} --state all --fields index,title,head,state --output csv | egrep '${{ github.ref_name }}' | head -1 | egrep 'open'
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 }}' | head -1 | awk -F',' '{print $4}' | sed -e 's|"||g')
echo "PR state: ${pr_state}"
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
echo "An open PR exists, skipping creation..."
elif [ $? -eq 1 ]; then
echo "PR does not exist, creating..."
echo "No open PRs, creating one..."
tea pr c -r "${{ github.repository }}" -t "Automated PR for ${{ github.ref_name }}" -d "Automated PR for ${{ github.ref_name }}"
fi