From c161ab6e404e00e3da92f124d51bbc4681038d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Thu, 15 Sep 2022 14:50:57 +0800 Subject: [PATCH] chore: Fix Argos build diff fail of outside contributor (#37555) --- .github/workflows/ui-upload.yml | 62 +++++++++++++++++++++++++++++++++ .github/workflows/ui.yml | 45 +++++++++++++++++++----- 2 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ui-upload.yml diff --git a/.github/workflows/ui-upload.yml b/.github/workflows/ui-upload.yml new file mode 100644 index 0000000000..e2f694af3a --- /dev/null +++ b/.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: 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