chore: Trigger Argos with white-listed users (#45115)

* chore: trigger argos manually

* chore: trigger argos manually

* chore: trigger argos manually

* chore: trigger argos manually

* chore: trigger argos manually

* chore: trigger argos manually

* chore: trigger argos manually

* chore: test

* chore: test

* chore: test

* chore: test

* chore: test

* chore: test

* chore: test

* chore: test

* chore: test

* chore: test

* feat: add white-listed

* feat: add white-listed

* feat: add white-listed

* feat: add white-listed

* feat: add white-listed

* feat: add white-listed

* feat: add white-listed

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

---------

Co-authored-by: kiner-tang(文辉) <134478213+lke-twh@users.noreply.github.com>
This commit is contained in:
kiner-tang(文辉) 2023-09-29 14:31:16 +08:00 committed by GitHub
parent 65975f2e5f
commit 5962e3a89d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,63 @@
# Due to some special reasons, some accounts are blocked by circleCI
# and cannot trigger argos jobs through circleCI.
# These accounts can be configured in the whitelist list
# and do not need to rely on circleCI to directly trigger argos in the PR workflow
name: Trigger Argos with white-listed users
on: [push]
permissions:
contents: read
jobs:
trigger_argos_with_whitelist_users:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Read white listed users
id: read_users
run: |
whitelist_file="argos-white-listed-users"
if [[ -f $whitelist_file ]]; then
users=$(cat $whitelist_file)
echo "whitelisted_users=$users" >> $GITHUB_OUTPUT
fi
- name: Check if user is whitelisted
id: check_user
run: |
whitelisted_users="${{ steps.read_users.outputs.whitelisted_users }}"
current_user="${{ github.actor }}"
if grep -Fxq "$current_user" <<< "$whitelisted_users"; then
echo "User is whitelisted"
echo "whitelisted=true" >> $GITHUB_OUTPUT
else
echo "User is not whitelisted"
echo "whitelisted=false" >> $GITHUB_OUTPUT
fi
- name: install dependencies
if: ${{ steps.check_user.outputs.whitelisted == 'true' }}
run: yarn
- name: Build dist file
id: build
if: ${{ steps.check_user.outputs.whitelisted == 'true' }}
run: npm run dist:esbuild
- name: Run image screenshot tests
id: screenshot
if: ${{ steps.check_user.outputs.whitelisted == 'true' }}
run: npm run test-image
- name: Upload screenshots to Argos CI
id: upload
if: ${{ steps.check_user.outputs.whitelisted == 'true' }}
env:
ARGOS_TOKEN: ${{ secrets.ARGOS_TOKEN }}
ARGOS_PARALLEL_NONCE: ${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
run: npm run argos

1
argos-white-listed-users Normal file
View File

@ -0,0 +1 @@
kiner-tang