This commit is contained in:
2025-01-15 12:10:52 -05:00
parent 88380e6991
commit ef24bb97e5
+25 -16
View File
@@ -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