Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a GitHub Action #239

Closed
Shinigami92 opened this issue Oct 21, 2023 · 2 comments · Fixed by #240
Closed

Provide a GitHub Action #239

Shinigami92 opened this issue Oct 21, 2023 · 2 comments · Fixed by #240
Labels
discussion Let's discuss

Comments

@Shinigami92
Copy link
Contributor

Shinigami92 commented Oct 21, 2023

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:

@Scony
Copy link
Owner

Scony commented Oct 22, 2023

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

@Scony Scony added the discussion Let's discuss label Oct 22, 2023
@Shinigami92
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Let's discuss
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants