Add fix to reshow card icon if previously it failed to load #2480
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate remote assets | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
check-secured-fields-assets: | |
if: contains(github.head_ref, 'changeset-release') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Getting SF_VERSION in the codebase | |
run: | | |
echo "SF_VERSION=$(grep -e 'SF_VERSION' packages/lib/src/components/internal/SecuredFields/lib/constants.ts | cut -d "'" -f2)" >> $GITHUB_ENV | |
- name: Encoding test origin URL to base64 | |
run: | | |
echo "BTOA_TEST_ORIGIN=$(echo ${{ secrets.TEST_ORIGIN }} | base64)" >> $GITHUB_ENV | |
- name: Requesting securedFields in production | |
id: securedFieldsRequest | |
uses: fjogeleit/http-request-action@main | |
with: | |
url: "https://checkoutshopper-live-us.adyen.com/checkoutshopper/securedfields/${{secrets.TEST_CLIENT_KEY}}/${{ env.SF_VERSION }}/securedFields.html?type=card&d=${{env.BTOA_TEST_ORIGIN}}" | |
method: "GET" | |
customHeaders: '{"Origin": "${{secrets.TEST_ORIGIN}}"}' | |
- name: Comment PR that request failed | |
if: failure() | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { issue: { number: issue_number }, repo: { owner, repo } } = context; | |
await github.rest.issues.createComment({ issue_number, owner, repo, body: '⚠️ WARNING: SecuredFields v${{ env.SF_VERSION }} might not be available live ⚠️ }); | |
- name: Comment PR that request succeeded | |
if: success() | |
uses: actions/[email protected] | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { issue: { number: issue_number }, repo: { owner, repo } } = context; | |
await github.rest.issues.createComment({ issue_number, owner, repo, body: '✅ SecuredFields v${{ env.SF_VERSION }} are available live' }); |