JSON pre-processing tweaks.
This commit is contained in:
@@ -54,65 +54,68 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
input: ${{ steps.preprocess-response.outputs.response_json }}
|
input: ${{ steps.preprocess-response.outputs.response_json }}
|
||||||
action: "get"
|
action: "get"
|
||||||
key: ""
|
key: "status"
|
||||||
|
|
||||||
|
- name: json-utils output
|
||||||
|
run: |
|
||||||
|
echo "${{ steps.parse-pr.outputs.result }}"
|
||||||
# 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: env.pr_exists == 'false'
|
if: ${{ steps.parse-pr.outputs.status == '404' }}
|
||||||
id: create-pr
|
id: create-pr
|
||||||
uses: arifer612/Gitea-PR-action@v1.2.0
|
uses: arifer612/Gitea-PR-action@v1.2.0
|
||||||
with:
|
with:
|
||||||
url: ${{ vars.RINOA_GITEA_URL }}
|
url: ${{ vars.RINOA_GITEA_URL }}
|
||||||
token: ${{ secrets.GITEA_API_TOKEN }}"
|
token: ${{ secrets.GITEA_API_TOKEN }}"
|
||||||
|
|
||||||
# Job 2: Run SonarQube Analysis
|
# # Job 2: Run SonarQube Analysis
|
||||||
sonarqube-analysis:
|
# sonarqube-analysis:
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
needs: check-and-create-pr
|
# needs: check-and-create-pr
|
||||||
outputs:
|
# outputs:
|
||||||
quality_gate_status: ${{ steps.quality-gate.outputs.quality-gate-status }}
|
# quality_gate_status: ${{ steps.quality-gate.outputs.quality-gate-status }}
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout Code
|
# - name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
# uses: actions/checkout@v4
|
||||||
|
|
||||||
# Step 1: Run SonarQube Scan
|
# # Step 1: Run SonarQube Scan
|
||||||
- name: SonarQube Scan
|
# - name: SonarQube Scan
|
||||||
uses: sonarsource/sonarqube-scan-action@v4.1.0
|
# uses: sonarsource/sonarqube-scan-action@v4.1.0
|
||||||
env:
|
# env:
|
||||||
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
# SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
# SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||||
|
|
||||||
# Step 2: SonarQube Quality Gate Check
|
# # Step 2: SonarQube Quality Gate Check
|
||||||
- name: SonarQube Quality Gate
|
# - name: SonarQube Quality Gate
|
||||||
id: quality-gate
|
# id: quality-gate
|
||||||
uses: sonarsource/sonarqube-quality-gate-action@v1
|
# uses: sonarsource/sonarqube-quality-gate-action@v1
|
||||||
env:
|
# env:
|
||||||
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
# SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
# SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||||
|
|
||||||
- name: Log Quality Gate Result
|
# - name: Log Quality Gate Result
|
||||||
run: |
|
# run: |
|
||||||
echo "Quality Gate Status: ${{ steps.quality-gate.outputs.quality-gate-status }}"
|
# echo "Quality Gate Status: ${{ steps.quality-gate.outputs.quality-gate-status }}"
|
||||||
|
|
||||||
# Job 3: Merge PR if Quality Gate passes
|
# # Job 3: Merge PR if Quality Gate passes
|
||||||
merge-pr:
|
# merge-pr:
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
needs: [check-and-create-pr, sonarqube-analysis]
|
# needs: [check-and-create-pr, sonarqube-analysis]
|
||||||
if: needs.sonarqube-analysis.outputs.quality_gate_status == 'PASSED'
|
# if: needs.sonarqube-analysis.outputs.quality_gate_status == 'PASSED'
|
||||||
steps:
|
# steps:
|
||||||
- name: Merge PR in Gitea
|
# - name: Merge PR in Gitea
|
||||||
uses: prasiman/gocurl@v1
|
# uses: prasiman/gocurl@v1
|
||||||
with:
|
# with:
|
||||||
url: "${{ secrets.GITEA_INSTANCE_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ needs.check-and-create-pr.outputs.pr_index }}"
|
# url: "${{ secrets.GITEA_INSTANCE_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ needs.check-and-create-pr.outputs.pr_index }}"
|
||||||
method: "POST"
|
# method: "POST"
|
||||||
headers: '{ "Authorization": "token ${{ secrets.GITEA_API_TOKEN }}", "Content-Type": "application/json" }'
|
# headers: '{ "Authorization": "token ${{ secrets.GITEA_API_TOKEN }}", "Content-Type": "application/json" }'
|
||||||
params: >-
|
# params: >-
|
||||||
{
|
# {
|
||||||
"Do": "merge",
|
# "Do": "merge",
|
||||||
"delete_branch_after_merge": true,
|
# "delete_branch_after_merge": true,
|
||||||
"force_merge": true,
|
# "force_merge": true,
|
||||||
"merge_when_checks_succeed": true
|
# "merge_when_checks_succeed": true
|
||||||
}
|
# }
|
||||||
|
|
||||||
- name: Confirm Merge
|
# - name: Confirm Merge
|
||||||
run: echo "PR has been successfully merged into main."
|
# run: echo "PR has been successfully merged into main."
|
||||||
|
|||||||
Reference in New Issue
Block a user