Browse Source

chore: Fix Argos build diff fail of outside contributor (#37555)

pull/37549/merge
二货爱吃白萝卜 2 years ago
committed by GitHub
parent
commit
c161ab6e40
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 62
      .github/workflows/ui-upload.yml
  2. 45
      .github/workflows/ui.yml

62
.github/workflows/ui-upload.yml

@ -0,0 +1,62 @@
# Upload 📷 UI snapshots to argos server, help visual regression testing.
name: 📷 UI Upload
on:
workflow_run:
workflows: ["📷 UI"]
types:
- completed
permissions:
contents: read
jobs:
upload-ui:
permissions:
actions: read # for dawidd6/action-download-artifact to query and download artifacts
pull-requests: read # for dawidd6/action-download-artifact to query commit hash
name: deploy preview
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success'
steps:
- name: checkout
uses: actions/checkout@v3
- name: Download commit artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: commit
- name: Save commit id
id: commit
run: echo "::set-output name=id::$(<commit.txt)"
- name: Download branch artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: branch
- name: Save branch id
id: branch
run: echo "::set-output name=id::$(<branch.txt)"
- name: Download snapshots artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: snapshots
path: imageSnapshots
- name: Install
run: npm i fast-glob lodash @argos-ci/core
- name: Upload on Argos
id: deploy
run: npm run argos
env:
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
ARGOS_PARALLEL_NONCE: ${{ github.run_id }}

45
.github/workflows/ui.yml

@ -52,12 +52,39 @@ jobs:
- name: test - name: test
run: npm run test-image run: npm run test-image
- name: Install dependencies to run Argos upload - name: upload snapshots artifact
run: npm i fast-glob lodash @argos-ci/core uses: actions/upload-artifact@v3
with:
- name: Upload on Argos name: snapshots
id: deploy path: imageSnapshots/
run: npm run argos retention-days: 3
env:
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }} - name: Save commit
ARGOS_PARALLEL_NONCE: ${{ github.run_id }} if: github.event_name == 'pull_request' && github.base_ref == 'master'
run: echo ${{ github.event.pull_request.head.sha }} > ./commit.txt
- name: Save commit
if: github.event_name == 'push'
run: echo ${{ github.sha }} > ./commit.txt
- name: Upload commit
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: commit
path: ./commit.txt
- name: Save branch
if: github.event_name == 'pull_request' && github.base_ref == 'master'
run: echo pull/${{ github.event.pull_request.number }}/merge > ./branch.txt
- name: Save branch
if: github.event_name == 'push'
run: echo ${GITHUB_REF##*/} > ./branch.txt
- name: Upload branch
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: branch
path: ./branch.txt

Loading…
Cancel
Save