Skip to content

Update Phantom UI

Update Phantom UI #123

name: Update Phantom UI
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: {}
permissions:
pull-requests: write
contents: write
jobs:
update-phantom:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: main
- uses: actions/checkout@v4
with:
repository: PhantomUIx/core
path: phantom-core
- uses: goto-bus-stop/setup-zig@v2
- name: Update Phantom UI
run: |
export PHANTOM_SHA=$(git -C phantom-core rev-parse HEAD)
export PHANTOM_SHA_SHORT=$(echo "$PHANTOM_SHA" | cut -c 1-6)
echo "PHANTOM_SHA=$PHANTOM_SHA" >> $GITHUB_ENV
echo "PHANTOM_SHA_SHORT=$PHANTOM_SHA_SHORT" >> $GITHUB_ENV
pushd main
zig fetch --save=phantom https://github.com/PhantomUIx/core/archive/$PHANTOM_SHA.tar.gz
git config user.name "GitHub Actions Bot"
git config user.email "<>"
if ! git diff-index --quiet HEAD --; then
git add build.zig.zon
git commit build.zig.zon -m "chore: update core to $PHANTOM_SHA"
export HAS_CHANGES=yes
else
export HAS_CHANGES=no
fi
echo "HAS_CHANGES=$HAS_CHANGES" >> $GITHUB_ENV
popd
- name: Open PR
uses: peter-evans/create-pull-request@v5
if: ${{ env.HAS_CHANGES == 'yes' }}
with:
title: "Update Phantom UI core to ${{ env.PHANTOM_SHA }}"
branch: update-phantom/${{ env.PHANTOM_SHA_SHORT }}
path: main