/github-action-awesome-lint

GitHub Action for awesome-lint where you specify the package version!

Primary LanguageShellMIT LicenseMIT

Deprecated, use npx -y awesome-lint 'path/to/file.md' instead.

deprecated readme

GitHub Action for Awesome Lint (Versionless)!

Marketplace Release .github/workflows/tests.yml .github/workflows/lint.yml

This Action wraps awesome-lint allowing easy linting of your awesome projects!

Contents

Versionless?

What I mean by versionless, is that this Action allows consumers to specify the version of the awesome-lint package they desire.

Why do this? What are the downsides?

Pinning your Actions to a commit sha d007f09bd2de33809fb3c0e43f8461d092d38970 is preferred as it is considered more secure to pinning to release numbers v1.0.0 or branch names main as the code cannot change without you explicitly opting-in.

This design allows people to pin to a commit sha of this Action with the freedom to update the version of awesome-lint independently. This is not possible in an Action written in JavaScript, or with Docker build-time dependency installation.

In my opinion, an Action that wraps an existing tool for consumption in GitHub Actions should only provide that convenience. And that convenience shouldn't require them to constantly be updating their usage. It does make updating the version of awesome-lint manual, but again, that is the more secure option to take.

Downsides?

npm install is performed at time of use. The Action still requires to be built with Docker, so even if the npm install was performed in the Dockerfile it wouldn't save the ~12 second npm install time. If the Action was reused, it would need to npm install on each use, even if the Docker image was cached. A small tradeoff if you ask me.

Inputs

  • args - Optional. These are the arguments to pass to the awesome-lint CLI.

Environment Variables

  • AWESOME_LINT_VERSION - Optional. The awesome-lint package version you wish to use.

Example Usage

Vanilla

awesome-lint CLI will automatically lint README.md:

name: Lint Awesome List
on: [push]

jobs:
  awesome-lint:
    name: "lint: awesome-lint"
    runs-on: ubuntu-latest
    steps:
      - name: "checkout repo"
        uses: actions/checkout@v2.0.0
        with:
          fetch-depth: 0
      - name: Test awesome-lint with custom file path
        uses: jthegedus/github-action-awesome-lint@68fc989d5a01aa127ce502a59f72ebe4166386f1 # commit_sha of tag v0.1.0

Custom File

Specify the file to lint:

name: Lint Awesome List
on: [push]

jobs:
  awesome-lint:
    name: "lint: awesome-lint"
    runs-on: ubuntu-latest
    steps:
      - name: "checkout repo"
        uses: actions/checkout@v2.0.0
        with:
          fetch-depth: 0
      - name: Test awesome-lint with custom file path
        uses: jthegedus/github-action-awesome-lint@68fc989d5a01aa127ce502a59f72ebe4166386f1 # commit_sha of tag v0.1.0
        with:
          args: "path/to/file.md

Specific awesome-lint Version

Specify the awesome-lint package you wish to install from npm:

name: Lint Awesome List
on: [push]

jobs:
  awesome-lint:
    name: "lint: awesome-lint"
    runs-on: ubuntu-latest
    steps:
      - name: "checkout repo"
        uses: actions/checkout@v2.0.0
        with:
          fetch-depth: 0
      - name: Test custom awesome-lint version
        uses: jthegedus/github-action-awesome-lint@68fc989d5a01aa127ce502a59f72ebe4166386f1 # commit_sha of tag v0.1.0
        env:
          AWESOME_LINT_VERSION: "0.11"

Specific awesome-lint Version with Custom File

Combination of all custom values:

name: Lint Awesome List
on: [push]

jobs:
  awesome-lint:
    name: "lint: awesome-lint"
    runs-on: ubuntu-latest
    steps:
      - name: "checkout repo"
        uses: actions/checkout@v2.0.0
        with:
          fetch-depth: 0
      - name: Test custom awesome-lint version
        uses: jthegedus/github-action-awesome-lint@68fc989d5a01aa127ce502a59f72ebe4166386f1 # commit_sha of tag v0.1.0
        env:
          AWESOME_LINT_VERSION: "0.11"
        with:
          args: "path/to/file.md"

Contributions

Contributions of any kind welcome, just follow the guidelines!

Contributors

Thanks goes to these contributors!

Todo List

After the below are complete we will cut a major semver release: v1.0.0.

Tests:

Functionality:

  • Runtime check for new version of Action being used with announcement log in usage
  • Improved logging (find out how GitHub Actions performs highlighting and determine nice visual pattern to follow)

Other:

  • Blog post about installing deps at runtime
  • GitHub Actions template

Security

See our policy

License

MIT License