Logic testing for PR creation.
This commit is contained in:
@@ -20,26 +20,32 @@ jobs:
|
|||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Step 1: Check for an existing PR
|
|
||||||
- name: Check if PR Exists
|
- name: Check if PR Exists
|
||||||
id: check-pr
|
id: check-pr
|
||||||
run: |
|
run: |
|
||||||
echo "Checking for existing PR..."
|
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
|
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
|
- name: var test
|
||||||
run: |
|
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
|
# - name: Get PR status
|
||||||
with:
|
# id: get-pr-status
|
||||||
input: '${{ toJSON(steps.check-pr.outputs.pr_status) }}'
|
# uses: yakubique/json-utils@v1.8
|
||||||
action: "get"
|
# with:
|
||||||
key: "state"
|
# input: '${{ toJSON(steps.check-pr.outputs.pr_status) }}'
|
||||||
|
# action: "get"
|
||||||
|
# key: "state"
|
||||||
# Step 2: Create PR if none exists
|
# Step 2: Create PR if none exists
|
||||||
# - name: Create PR in Gitea
|
# - name: Create PR in Gitea
|
||||||
# if: steps.check-pr.outputs.pr_http_status.state == 'closed'
|
# if: steps.check-pr.outputs.pr_http_status.state == 'closed'
|
||||||
|
|||||||
Reference in New Issue
Block a user