Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 43 additions & 15 deletions .github/workflows/optional-spec-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,30 @@ on:
secrets: # all secrets are passed explicitly in this workflow
api_bot_pat:
required: true
jira_api_token:
required: true


permissions:
contents: write
issues: write
id-token: write

jobs:
jobs:
optional-validations:
runs-on: ubuntu-latest
outputs:
postman-validation-failed: ${{ steps.set-outputs.outputs.postman-validation-failed }}
ipa-validation-failed: ${{ steps.set-outputs.outputs.ipa-validation-failed }}
steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Checkout .github folder from main branch
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
ref: main
sparse-checkout: |
.github/workflows
- name: Setup Node
uses: actions/setup-node@v6
with:
Expand Down Expand Up @@ -53,17 +64,34 @@ jobs:
make convert_to_collection
npx -- @stoplight/spectral-cli@"${SPECTRAL_VERSION}" lint ./tmp/collection.json --ruleset=./validation/spectral.yaml
popd
- name: Create Issue - Postman validation Failed
if: ${{ failure() && steps.spectral-validation.outcome == 'failure' }}
uses: ./.github/workflows/task-failure-handler.yml
with:
env: ${{ inputs.env }}
task_name: 'Optional Postman validation'
team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }}
- name: Create Issue - IPA validation Failed
if: ${{ failure() && steps.ipa-spectral-validation.outcome == 'failure'}}
uses: ./.github/workflows/task-failure-handler.yml
with:
env: ${{ inputs.env }}
task_name: 'Optional IPA validation'
team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }}
- name: Set outputs for error handling
id: set-outputs
if: always()
run: |
echo "postman-validation-failed=${{ steps.spectral-validation.outcome == 'failure' }}" >> $GITHUB_OUTPUT
echo "ipa-validation-failed=${{ steps.ipa-spectral-validation.outcome == 'failure' }}" >> $GITHUB_OUTPUT

postman-validation-error-handler:
name: Handle Postman Validation Error
needs: optional-validations
if: ${{ always() && needs.optional-validations.outputs.postman-validation-failed == 'true' }}
uses: ./.github/workflows/task-failure-handler.yml
with:
env: ${{ inputs.env }}
task_name: 'Optional Postman validation'
team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }}
secrets:
jira_api_token: ${{ secrets.jira_api_token }}

ipa-validation-error-handler:
name: Handle IPA Validation Error
needs: optional-validations
if: ${{ always() && needs.optional-validations.outputs.ipa-validation-failed == 'true' }}
uses: ./.github/workflows/task-failure-handler.yml
with:
env: ${{ inputs.env }}
task_name: 'Optional IPA validation'
team_id: ${{ vars.JIRA_TEAM_ID_APIX_PLATFORM }}
secrets:
jira_api_token: ${{ secrets.jira_api_token }}

1 change: 1 addition & 0 deletions .github/workflows/release-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
uses: ./.github/workflows/optional-spec-validations.yml
secrets:
api_bot_pat: ${{ secrets.api_bot_pat }}
jira_api_token: ${{ secrets.jira_api_token }}
with:
env: ${{ inputs.env }}
spectral_version: ${{ vars.SPECTRAL_VERSION }}
Expand Down
Loading