Logic testing for PR creation.

This commit is contained in:
2024-12-17 12:33:23 -05:00
parent d36d4927f6
commit 1f9ee7b47b
+17 -11
View File
@@ -20,26 +20,32 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
# Step 1: Check for an existing PR
- name: Check if PR Exists
id: check-pr
run: |
echo "Checking for existing PR..."
curl ${{ vars.RINOA_GITEA_URL }}/api/v1/repos/${{ github.repository }}/pulls/main/${{ github.ref_name }} -X 'GET' -H 'Accept: application/json' -H 'Authorization: token ${{ secrets.BOT_GITEA_TOKEN }}' -s | jq '{index: .number, state: .state}' > pr_status.json
curl ${{ vars.RINOA_GITEA_URL }}/api/v1/repos/${{ github.repository }}/pulls/main/${{ github.ref_name }} \
-X 'GET' \
-H 'Accept: application/json' \
-H 'Authorization: token ${{ secrets.BOT_GITEA_TOKEN }}' \
-s | jq '{index: .number, state: .state}' > pr_status.json
cat pr_status.json
echo "pr_status=$(cat pr_status.json)" >> $GITHUB_OUTPUT
echo "pr_status=$(jq -c . pr_status.json)" >> "$GITHUB_OUTPUT"
- name: var test
run: |
echo "pr_status: ${{ steps.check-pr.outputs.pr_status }}"
echo "pr_status: ${{ steps.check-pr.outputs.pr_status }}"
- name: Get PR status
id: get-pr-status
uses: yakubique/json-utils@v1.8
with:
input: '${{ toJSON(steps.check-pr.outputs.pr_status) }}'
action: "get"
key: "state"
# - name: Get PR status
# id: get-pr-status
# uses: yakubique/json-utils@v1.8
# with:
# input: '${{ toJSON(steps.check-pr.outputs.pr_status) }}'
# action: "get"
# key: "state"
# Step 2: Create PR if none exists
# - name: Create PR in Gitea
# if: steps.check-pr.outputs.pr_http_status.state == 'closed'