|
13 | 13 | secrets: # all secrets are passed explicitly in this workflow |
14 | 14 | api_bot_pat: |
15 | 15 | required: true |
| 16 | + jira_api_token: |
| 17 | + required: true |
16 | 18 |
|
17 | 19 |
|
18 | 20 | permissions: |
19 | 21 | contents: write |
20 | 22 | issues: write |
21 | 23 | id-token: write |
22 | 24 |
|
23 | | -jobs: |
| 25 | +jobs: |
24 | 26 | optional-validations: |
25 | 27 | runs-on: ubuntu-latest |
| 28 | + outputs: |
| 29 | + postman-validation-failed: ${{ steps.set-outputs.outputs.postman-validation-failed }} |
| 30 | + ipa-validation-failed: ${{ steps.set-outputs.outputs.ipa-validation-failed }} |
26 | 31 | steps: |
27 | 32 | - name: Checkout repository |
28 | 33 | uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
| 34 | + - name: Checkout .github folder from main branch |
| 35 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
| 36 | + with: |
| 37 | + ref: main |
| 38 | + sparse-checkout: | |
| 39 | + .github/workflows |
29 | 40 | - name: Setup Node |
30 | 41 | uses: actions/setup-node@v6 |
31 | 42 | with: |
@@ -53,17 +64,34 @@ jobs: |
53 | 64 | make convert_to_collection |
54 | 65 | npx -- @stoplight/spectral-cli@"${SPECTRAL_VERSION}" lint ./tmp/collection.json --ruleset=./validation/spectral.yaml |
55 | 66 | popd |
56 | | - - name: Create Issue - Postman validation Failed |
57 | | - if: ${{ failure() && steps.spectral-validation.outcome == 'failure' }} |
58 | | - uses: ./.github/workflows/task-failure-handler.yml |
59 | | - with: |
60 | | - env: ${{ inputs.env }} |
61 | | - task_name: 'Optional Postman validation' |
62 | | - team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }} |
63 | | - - name: Create Issue - IPA validation Failed |
64 | | - if: ${{ failure() && steps.ipa-spectral-validation.outcome == 'failure'}} |
65 | | - uses: ./.github/workflows/task-failure-handler.yml |
66 | | - with: |
67 | | - env: ${{ inputs.env }} |
68 | | - task_name: 'Optional IPA validation' |
69 | | - team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }} |
| 67 | + - name: Set outputs for error handling |
| 68 | + id: set-outputs |
| 69 | + if: always() |
| 70 | + run: | |
| 71 | + echo "postman-validation-failed=${{ steps.spectral-validation.outcome == 'failure' }}" >> $GITHUB_OUTPUT |
| 72 | + echo "ipa-validation-failed=${{ steps.ipa-spectral-validation.outcome == 'failure' }}" >> $GITHUB_OUTPUT |
| 73 | +
|
| 74 | + postman-validation-error-handler: |
| 75 | + name: Handle Postman Validation Error |
| 76 | + needs: optional-validations |
| 77 | + if: ${{ always() && needs.optional-validations.outputs.postman-validation-failed == 'true' }} |
| 78 | + uses: ./.github/workflows/task-failure-handler.yml |
| 79 | + with: |
| 80 | + env: ${{ inputs.env }} |
| 81 | + task_name: 'Optional Postman validation' |
| 82 | + team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }} |
| 83 | + secrets: |
| 84 | + jira_api_token: ${{ secrets.jira_api_token }} |
| 85 | + |
| 86 | + ipa-validation-error-handler: |
| 87 | + name: Handle IPA Validation Error |
| 88 | + needs: optional-validations |
| 89 | + if: ${{ always() && needs.optional-validations.outputs.ipa-validation-failed == 'true' }} |
| 90 | + uses: ./.github/workflows/task-failure-handler.yml |
| 91 | + with: |
| 92 | + env: ${{ inputs.env }} |
| 93 | + task_name: 'Optional IPA validation' |
| 94 | + team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }} |
| 95 | + secrets: |
| 96 | + jira_api_token: ${{ secrets.jira_api_token }} |
| 97 | + |
0 commit comments