You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to build this myself, but I couldn't succeed.
There is a script add-icons which accepts a string as the second parameter and runs validation checks, finds matching rawdata and updates the relevant metadata.json with the correct object structure.
The github action should be triggered on:
pull_request
push to main
pull_request_target (to enable prs from forks)
and then should:
compared the committed changes in packages/core/src/raw-svgs/ with the last commit of main and pass the modified or newly added paths to the add-icons script:
bun run add-icons {{SVG_PATHS}}
afterwards the action should build the packages
bun run build --filter=@token-icons/react --filter=@token-icons/core
write a commit message with the newly added svgs and commit to the trigger (to pull request or directly to the main brach)
the draft version of this action can be found under icon-add.yml
name: icon-addpermissions:
contents: writepull-requests: writeon:
push:
branches:
- mainpaths:
- 'packages/core/src/raw-svgs/**'pull_request:
branches:
- mainpaths:
- 'packages/core/src/raw-svgs/**'jobs:
update-and-rebuild:
runs-on: ubuntu-lateststeps:
- name: Setup bunuses: oven-sh/setup-bun@v1
- name: Checkout repositoryuses: actions/checkout@v2with:
fetch-depth: 10
- name: Set up Node.jsuses: actions/setup-node@v2with:
node-version: '20'
- name: Install dependenciesrun: bun install
- name: Identify New SVG Filesid: filesrun: | SVG_FILES=$(git diff --name-only HEAD^ HEAD | grep 'packages/core/src/raw-svgs/' | tr '\n' ',') echo "SVG_FILES=${SVG_FILES%,}" >> $GITHUB_ENV echo "New SVG Files: $SVG_FILES" echo "New Token Icons: $newTokenIcons" echo "New Network Icons: $newNetworkIcons"
- name: Update Metadataif: env.SVG_FILESrun: | newTokenIcons=$(git diff --name-only HEAD^ HEAD | grep 'packages/core/src/raw-svgs/tokens/' | xargs basename -a | sed 's/.svg//' | sort -u | tr '\n' ', ' | sed 's/, $//') newNetworkIcons=$(git diff --name-only HEAD^ HEAD | grep 'packages/core/src/raw-svgs/networks/' | xargs basename -a | sed 's/.svg//' | sort -u | tr '\n' ', ' | sed 's/, $//') echo "newTokenIcons=$newTokenIcons" >> $GITHUB_ENV echo "newNetworkIcons=$newNetworkIcons" >> $GITHUB_ENV bun run ./packages/utils/src/scripts/add-icons.ts ${{ env.SVG_FILES }}
- name: Build Packagesrun: | bun run build --filter=@tknicns/core --filter=@tknicns/react
- name: Commit Changesrun: | git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' git add . commitMessage="" description="" if [ -n "$newTokenIcons" ] && [ -n "$newNetworkIcons" ]; then commitMessage="core: add new token icons & network icons" description+="token icons: $newTokenIcons\nnetwork icons: $newNetworkIcons" elif [ -n "$newTokenIcons" ]; then commitMessage="core: add new token icons" description+="token icons: $newTokenIcons" elif [ -n "$newNetworkIcons" ]; then commitMessage="core: add new network icons" description+="network icons: $newNetworkIcons" fi if [ -n "$description" ]; then git commit -m "$commitMessage" -m "$description" || echo "No changes to commit" else echo "No new icons to commit" fi git push origin ${GITHUB_HEAD_REF:-${GITHUB_REF}}
The text was updated successfully, but these errors were encountered:
I've tried to build this myself, but I couldn't succeed.
There is a script add-icons which accepts a string as the second parameter and runs validation checks, finds matching rawdata and updates the relevant metadata.json with the correct object structure.
The github action should be triggered on:
and then should:
packages/core/src/raw-svgs/
with the last commit ofmain
and pass the modified or newly added paths to theadd-icons
script:afterwards the action should build the packages
write a commit message with the newly added svgs and commit to the trigger (to pull request or directly to the main brach)
the draft version of this action can be found under icon-add.yml
The text was updated successfully, but these errors were encountered: