Skip to content

Add logo for Taiko and Arbitrum-sepolia networks #345

Add logo for Taiko and Arbitrum-sepolia networks

Add logo for Taiko and Arbitrum-sepolia networks #345

Workflow file for this run

name: pr-checks
on:
pull_request_target:
branches: ["main"]
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
changed_files:
runs-on: ubuntu-latest
name: PR automated checks
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
- name: Process changed files
id: changes-errors
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo 'errorsStr<<EOF' >> $GITHUB_OUTPUT
# Filter out .yml files
FILTERED_FILES=$(echo "$ALL_CHANGED_FILES" | tr ' ' '\n' | grep -v '\.yml$' | tr '\n' ' ')
for file in $FILTERED_FILES; do
echo "Processing file: $file"
if [[ $file != images/* ]] && [[ $file != platforms/* ]] && [[ $file != chains/* ]] ;
then
errorText="Only additions of token icons (in the /images folder) or platform logos (in the /platforms folder) are permitted"
errorOutputText="- Error with \`$file\`: $errorText"
echo "::error file=$file::$errorText"
echo "$errorOutputText" >> $GITHUB_OUTPUT
fi
# Only check token icon additions, not platform icons which don't have anything automated
if [[ $file == images/assets* ]] ;
then
if [[ $file != *.png ]] ;
then
errorText="The new icon must be a PNG file"
errorOutputText="- Error with \`$file\`: $errorText"
echo "::error file=$file::$errorText"
echo "$errorOutputText" >> $GITHUB_OUTPUT
elif [[ ! $file =~ ^images/assets(-[a-z]+)*/[a-z0-9]+\.png$ ]] ;
then
errorText="The new icon's filename must be entirely lowercase"
errorOutputText="- Error with \`$file\`: $errorText"
echo "::error file=$file::$errorText"
echo "$errorOutputText" >> $GITHUB_OUTPUT
fi
fi
done
echo 'EOF' >> $GITHUB_OUTPUT
- name: Check if errors
id: check-if-errors
env:
ERRORS: ${{ steps.changes-errors.outputs.errorsStr }}
run: |
errorsStrLength=${#ERRORS}
echo "prev output : $ERRORS $errorsStrLength"
if (( errorsStrLength == 0 ));
then
echo 'hasErrors=false'
echo "hasErrors=false" >> "$GITHUB_OUTPUT"
else
echo 'hasErrors=true'
echo "hasErrors=true" >> "$GITHUB_OUTPUT"
fi
- name: Comment on PR if error
env:
ERRORS: ${{ steps.changes-errors.outputs.errorsStr }}
HAS_ERRORS: ${{ steps.check-if-errors.outputs.hasErrors }}
uses: thollander/actions-comment-pull-request@v2
if: ${{ env.HAS_ERRORS == 'true' }}
with:
message: |
Changes are required before your pull request can be reviewed:
${{ env.ERRORS }}
- name: Exit with error
env:
ERRORS: ${{ steps.changes-errors.outputs.errorsStr }}
HAS_ERRORS: ${{ steps.check-if-errors.outputs.hasErrors }}
if: ${{ env.HAS_ERRORS == 'true' }}
run: |
mapfile myarray <<< $ERRORS
for ((i = 0; i < ${#myarray[@]}; ++i)); do
echo "::error::${myarray[i]}"
done
exit 1
update_tokenlist:
uses: ./.github/workflows/upload-tokenlist.yml
needs: changed_files
if: ${{ !failure() }}
secrets: inherit