Scony / godot-gdscript-toolkit

Independent set of GDScript tools - parser, linter, formatter, and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide a GitHub Action

Shinigami92 opened this issue · comments

Could we get a GitHub Action so we can run gdlint . and gdformat --check . from a GitHub workflow?

Here is an example for now how I use it:

@Shinigami92 what do you mean exactly? Please note I'm not an expert on GitHub workflows...

So what I would like to end up is like following:

Sadly this is not maintained anymore, so there is this nowadays:

So currently my pipeline looks like this:

name: CI

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  lint:
    runs-on: ubuntu-latest
    name: "Lint"
    steps:
      - name: Checkout
        uses: actions/checkout@v4.1.1
        with:
          fetch-depth: 0

      - name: Setup python
        uses: actions/setup-python@v4.7.1
        with:
          python-version: "3.12"
          cache: "pip"

      - name: Upgrade setuptools
        run: pip install --upgrade setuptools

      - name: Install gdtoolkit
        run: pip install gdtoolkit==4.*

      - name: Lint
        run: gdlint .

  formatting:
    runs-on: ubuntu-latest
    name: "Formatting"
    steps:
      - name: Checkout
        uses: actions/checkout@v4.1.1
        with:
          fetch-depth: 0

      - name: Setup python
        uses: actions/setup-python@v4.7.1
        with:
          python-version: "3.12"
          cache: "pip"

      - name: Upgrade setuptools
        run: pip install --upgrade setuptools

      - name: Install gdtoolkit
        run: pip install gdtoolkit==4.*

      - name: Check formatting
        run: gdformat --check .

And I would like to write it like this:

name: CI

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  lint:
    runs-on: ubuntu-latest
    name: "Lint"
    steps:
      - name: Checkout
        uses: actions/checkout@v4.1.1
        with:
          fetch-depth: 0

      - name: Setup gdtoolkit
        uses: Scony/godot-gdscript-toolkit@v4

      - name: Lint
        run: gdlint .

  formatting:
    runs-on: ubuntu-latest
    name: "Formatting"
    steps:
      - name: Checkout
        uses: actions/checkout@v4.1.1
        with:
          fetch-depth: 0

      - name: Setup gdtoolkit
        uses: Scony/godot-gdscript-toolkit@v4

      - name: Check formatting
        run: gdformat --check .

So Scony/godot-gdscript-toolkit@v4 would be in this case the action that is downloaded from the GitHub Action Marketplace and would have a site like this: https://github.com/marketplace/actions/rustup-toolchain-install

It could be that the action is slightly named differently if you e.g. prefer to create the action in another repository

I think https://github.com/dtolnay/rust-toolchain might also be a perfect source of example how to write such an action.
So there is an action.yml and tbh this might be the only thing that we need 🤔
I never wrote such an action.yml, but it looks relatively straight forward.
Here are more docs: https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions

  • I'm willing to contribute, just let me know if you want to have this in this repository

The only thing you would need on your own, is to find out how to actually publish that action to the marketplace