feat: add pet related lua callbacks #18870
Workflow file for this run
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: autofix.ci # needed to securely identify the workflow | |
| on: | |
| pull_request: | |
| paths: | |
| [ | |
| "**.json", | |
| "**.cpp", | |
| "**.hpp", | |
| "**.h", | |
| "**.c", | |
| "**.md", | |
| "**.ts", | |
| "**.lua", | |
| ] | |
| pull_request_target: | |
| types: [opened, edited, reopened, synchronize] | |
| permissions: | |
| contents: read | |
| env: | |
| DENO_DIR: /home/runner/.cache/deno | |
| LLVM_VERSION: "22" | |
| jobs: | |
| autofix: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - env: { DEBIAN_FRONTEND: noninteractive } | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends astyle gettext | |
| - name: Setup C++ format tools | |
| uses: aminya/setup-cpp@v1 | |
| with: | |
| compiler: llvm-${{ env.LLVM_VERSION }} | |
| clang-format: ${{ env.LLVM_VERSION }} | |
| cmake: true | |
| ninja: true | |
| ccache: true | |
| setup-cpp: false | |
| - name: Show clang-format version | |
| run: clang-format --version | |
| - uses: denoland/setup-deno@v2 | |
| with: { cache: true } | |
| - name: cache deno dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.DENO_DIR }} | |
| key: deno-${{ hashFiles('deno.lock') }} | |
| - name: format C++ files | |
| run: build-scripts/format-cpp.sh | |
| - name: format Markdown and TypeScript files | |
| run: deno fmt | |
| - name: format Lua files | |
| run: deno task dprint fmt | |
| - name: format JSON | |
| run: build-scripts/format-json.sh | |
| # autofix.ci cannot edit .github directory due to security reasons | |
| - name: unstage .github | |
| if: ${{ always() }} | |
| run: git restore .github | |
| - uses: autofix-ci/action@v1.3 | |
| if: ${{ always() }} | |
| with: | |
| commit-message: "style(autofix.ci): automated formatting" | |
| comment: | | |
| Autofix has formatted [code style violation][code-style] in this PR. | |
| <details><summary>I edit commits locally (e.g: git, github desktop) and want to keep autofix</summary> | |
| 1. Run `git pull`. this will merge the automated commit into your local copy of the PR branch. | |
| 2. Continue working. | |
| </details> | |
| <details><summary>I do not want the automated commit</summary> | |
| 1. [Format your code locally](https://docs.cataclysmbn.org/contribute/contributing/#code-style), then commit it. | |
| 2. Run `git push --force` to force push your branch. This will overwrite the automated commit on remote with your local one. | |
| 3. Continue working. | |
| </details> | |
| If you don't do this, your following commits will be based on the old commit, and cause **MERGE CONFLICT**. | |
| [code-style]: https://docs.cataclysmbn.org/contribute/contributing/#code-style | |
| - name: lint and test typescript files | |
| run: | | |
| # deno lint | |
| deno test --allow-read --allow-env=npm_package_config_libvips,TILESET_PYTHON --allow-ffi | |
| - name: check generated semantic PR config | |
| run: | | |
| deno run --allow-read --allow-write scripts/semantic.ts | |
| git diff --exit-code -- .github/semantic.yml | |
| lint: | |
| if: github.event_name == 'pull_request_target' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - if: >- | |
| github.event.action == 'opened' || | |
| github.event.action == 'edited' || | |
| github.event.action == 'reopened' | |
| uses: scarf005/conventional-prs@v0.5.1 | |
| - name: Checkout base docs warning script | |
| if: always() && github.event.pull_request.head.ref != github.event.repository.default_branch | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| sparse-checkout: | | |
| docs | |
| scripts/docs_translation_warning.ts | |
| scripts/git_changed_files.ts | |
| deno.jsonc | |
| deno.lock | |
| - name: Setup Deno for docs warning | |
| if: always() && github.event.pull_request.head.ref != github.event.repository.default_branch | |
| continue-on-error: true | |
| uses: denoland/setup-deno@v2 | |
| with: { cache: true } | |
| - name: Update docs translation PR body | |
| if: always() && github.event.pull_request.head.ref != github.event.repository.default_branch | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| ref=refs/remotes/pull/${{ github.event.pull_request.number }}/merge | |
| git fetch --no-tags --filter=blob:none --depth=2 origin "+refs/pull/${{ github.event.pull_request.number }}/merge:$ref" || exit 0 | |
| deno task docs:translation-warning ${{ github.event.pull_request.number }} --base "$ref^1" --head "$ref" || true | |
| - name: Comment and close pull request | |
| if: >- | |
| always() && | |
| ( github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' ) && | |
| github.event.pull_request.head.ref == github.event.repository.default_branch | |
| env: { GH_TOKEN: "${{ github.token }}" } | |
| run: | | |
| body="$(cat <<\BODY | |
| <!-- reject-main-branch-pr --> | |
| This pull request was opened from `main`, which can cause conflicts when updating your fork's `main` branch later. Please open a new pull request from a [feature branch](https://docs.cataclysmbn.org/contribute/contributing/#make-your-changes) instead. | |
| <details> | |
| <summary>How to open a new PR from a branch</summary> | |
| If your changes are already committed on `main`, create a branch at the same commit and push it: | |
| ```sh | |
| git switch main | |
| git switch -c your-branch-name | |
| git push -u origin your-branch-name | |
| ``` | |
| Then open a new pull request from `your-branch-name` and close this one. | |
| If `main` should go back to the upstream branch after that, update it separately after confirming your work is safely on the new branch. | |
| </details> | |
| BODY | |
| )" | |
| gh pr close "${{ github.event.pull_request.number }}" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --comment "$body" | |
| exit 1 | |
| - uses: actions/labeler@v6 | |
| if: >- | |
| always() && | |
| ( github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' ) | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} |