Skip to content

Commit 8a798d1

Browse files
committed
fix: workflows
1 parent 74ef254 commit 8a798d1

File tree

2 files changed

+44
-15
lines changed

2 files changed

+44
-15
lines changed

.github/workflows/optional-spec-validations.yml

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,30 @@ on:
1313
secrets: # all secrets are passed explicitly in this workflow
1414
api_bot_pat:
1515
required: true
16+
jira_api_token:
17+
required: true
1618

1719

1820
permissions:
1921
contents: write
2022
issues: write
2123
id-token: write
2224

23-
jobs:
25+
jobs:
2426
optional-validations:
2527
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 }}
2631
steps:
2732
- name: Checkout repository
2833
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
2940
- name: Setup Node
3041
uses: actions/setup-node@v6
3142
with:
@@ -53,17 +64,34 @@ jobs:
5364
make convert_to_collection
5465
npx -- @stoplight/spectral-cli@"${SPECTRAL_VERSION}" lint ./tmp/collection.json --ruleset=./validation/spectral.yaml
5566
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+

.github/workflows/release-spec.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jobs:
9696
uses: ./.github/workflows/optional-spec-validations.yml
9797
secrets:
9898
api_bot_pat: ${{ secrets.api_bot_pat }}
99+
jira_api_token: ${{ secrets.jira_api_token }}
99100
with:
100101
env: ${{ inputs.env }}
101102
spectral_version: ${{ vars.SPECTRAL_VERSION }}

0 commit comments

Comments
 (0)