Update SLua Definitions #126
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update SLua Definitions | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| update-definitions: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Check for upstream updates | |
| id: check | |
| run: | | |
| cd refs/lsl-definitions | |
| PINNED=$(git rev-parse HEAD) | |
| echo "pinned=$PINNED" >> "$GITHUB_OUTPUT" | |
| git fetch --unshallow origin main 2>/dev/null || git fetch origin main | |
| LATEST=$(git rev-parse origin/main) | |
| echo "latest=$LATEST" >> "$GITHUB_OUTPUT" | |
| if [ "$PINNED" = "$LATEST" ]; then | |
| echo "up-to-date=true" >> "$GITHUB_OUTPUT" | |
| echo "Submodule is already at latest upstream commit." | |
| else | |
| echo "up-to-date=false" >> "$GITHUB_OUTPUT" | |
| LOG=$(git log --oneline --no-decorate "$PINNED".."$LATEST") | |
| echo "commit-count=$(echo "$LOG" | wc -l | tr -d ' ')" >> "$GITHUB_OUTPUT" | |
| EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
| echo "log<<$EOF" >> "$GITHUB_OUTPUT" | |
| echo "$LOG" >> "$GITHUB_OUTPUT" | |
| echo "$EOF" >> "$GITHUB_OUTPUT" | |
| echo "latest-short=${LATEST:0:7}" >> "$GITHUB_OUTPUT" | |
| echo "compare-url=https://github.com/secondlife/lsl-definitions/compare/${PINNED}...${LATEST}" >> "$GITHUB_OUTPUT" | |
| echo "Found $(echo "$LOG" | wc -l | tr -d ' ') new upstream commit(s)." | |
| fi | |
| - name: Update submodule to latest | |
| if: steps.check.outputs.up-to-date == 'false' | |
| run: | | |
| cd refs/lsl-definitions | |
| git checkout ${{ steps.check.outputs.latest }} | |
| - uses: oven-sh/setup-bun@v2 | |
| if: steps.check.outputs.up-to-date == 'false' | |
| - name: Install dependencies | |
| if: steps.check.outputs.up-to-date == 'false' | |
| run: bun install | |
| - name: Regenerate types | |
| if: steps.check.outputs.up-to-date == 'false' | |
| run: bun run generate | |
| - name: Rebuild examples | |
| if: steps.check.outputs.up-to-date == 'false' | |
| run: bun run build:examples | |
| - name: Verify | |
| if: steps.check.outputs.up-to-date == 'false' | |
| run: | | |
| bun run test | |
| bun run fmt:check | |
| bun run lint | |
| - name: Create changeset | |
| if: steps.check.outputs.up-to-date == 'false' | |
| run: | | |
| cat > .changeset/bump-lsl-definitions.md << 'CHANGESET' | |
| --- | |
| "@gwigz/slua-types": patch | |
| --- | |
| Update SLua definitions submodule to latest upstream | |
| CHANGESET | |
| - name: Create pull request | |
| if: steps.check.outputs.up-to-date == 'false' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: chore/bump-lsl-definitions | |
| delete-branch: true | |
| commit-message: "chore(types): bump slua-definitions to ${{ steps.check.outputs.latest-short }}" | |
| title: "chore(types): bump slua-definitions submodule" | |
| body: | | |
| Automated update of the `refs/lsl-definitions` submodule to the latest upstream commit. | |
| ### Changes | |
| **${{ steps.check.outputs.commit-count }}** new commit(s) from [`${{ steps.check.outputs.pinned }}`..`${{ steps.check.outputs.latest }}`](${{ steps.check.outputs.compare-url }}): | |
| ``` | |
| ${{ steps.check.outputs.log }} | |
| ``` | |
| ### What this PR includes | |
| - Updated submodule pointer (`refs/lsl-definitions`) | |
| - Regenerated `packages/types/index.d.ts` | |
| - Changeset for `@gwigz/slua-types` (patch) | |
| > [!NOTE] | |
| > This PR was automatically generated by the [Update SLua Definitions](${{ github.server_url }}/${{ github.repository }}/actions/workflows/update-definitions.yml) workflow. | |
| labels: | | |
| dependencies | |
| automated |