vacuum icon indicating copy to clipboard operation
vacuum copied to clipboard

GitHub Action

Open philsturgeon opened this issue 1 year ago • 1 comments

Hey @daveshanley, I'm working on an blog post about getting Vacuum up and running with a docs provider.

One thing that would make life a whole lot easier (and this integration look a whole lot neater) would be getting a GitHub Action up and running.

There's something really rudimentary over here which you could fork to get started, if that is indeed the best way to get it going: https://github.com/eduelias/gha-vacuum/

If you get decent uptake on that, you could do two things:

  1. Post linting feedback as a comment.
  2. Potentially integrate with The Doctor to keep an eye on score going up or down, and attributing the cause of score drops to authors so you can have a... "polite" word.

Anyhow, for now, as basic one would be handy, to stop me trying to run arbitrary shell scripts, or figuring out brew install on GitHub Actions.

Cheers, and Merry Christmas!

philsturgeon avatar Dec 23 '24 17:12 philsturgeon

I have been planning on this, it's 100% on my radar.

The doctor exposes all the power of vacuum (more than vacuum as an app does) and it's been opening up all kinds of bugs and gaps, I am working toward a fully integrated github action, that will not only run rulesets against specs, it will perform a changelog and product charts etc. A lot like codecov does.

daveshanley avatar Dec 28 '24 16:12 daveshanley

Now that https://github.com/stoplightio/spectral-action is broken, this would be a really compelling alternative action. Hint hint.

hughsimpson avatar Jun 03 '25 12:06 hughsimpson

What happened? What is broken about it? Do you know if SmartBear are going to fix it?

To he honest, I am not that far off having the actual github action I want, which is powered by the doctor (pb33f.io/doctor) It's going to offer everything regular vacuum has and more, and change detection with history.

I am still not quite there yet however, I am building it actively at the moment though.

The question is though, what kind of stop-gap functionality would you want to see in a 'just vacuum as it is' action.

daveshanley avatar Jun 03 '25 13:06 daveshanley

@daveshanley it depends on gobinaries, which has been down for a day, and my gut says it's not coming back (just looking at the fact that it's not been updated for 5 years). I'm not sure if it's gonna be fixed by removing the gobinaries dependency, but I didn't see any action on the issue yet... to be honest I'd be happy for an action that just does

      - name: Lint OpenApi Spec
        run: |
          docker pull dshanley/vacuum:v0.16.14
          docker run --rm -v $PWD:/work:ro dshanley/vacuum:v0.16.14 lint -d -r .spectral.yml openapi.yml

since that would replace the functionality I've been using, but you probably have a much more capable action in mind (and, let's be honest, the fact that I can already do this directly without having a custom action does kinda raise the question of 'but what should it do that you can't already do?')

EDIT: It'd be nice to have a report-as-comment functionality, actually. That'd be better than having to click through to a failed action

hughsimpson avatar Jun 03 '25 13:06 hughsimpson

I see it's back online.

https://github.com/tj/gobinaries/issues/46

But I also get the need for an alternative here. Before I get my whizz bang version online, a simple report in a comment as markdown action via vacuum would suffice.

I'll bump it up my todo list, next break I get between builds, I'll slot this in.

daveshanley avatar Jun 03 '25 15:06 daveshanley

Yeah seems I was unfairly pessimistic about the speed with which this was fixed, but tbqh I appreciated the excuse to force removal of circular schema defns from our openapi spec and would rather stick with this one going forwards

hughsimpson avatar Jun 03 '25 17:06 hughsimpson

FYI: I am working on the action here:

https://github.com/pb33f/vacuum-action

It is a WIP, but it does work


name: "Lint OpenAPI spec with vacuum"

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

permissions:
  contents: read
  pull-requests: write

jobs:
  vacuum-lint:
    name: Run OpenAPI linting with vacuum
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Run OpenAPI lint with vacuum
        uses: pb33f/vacuum-action@v1
        with:
          openapi_path: "path/to/your/openapi.yaml"
          github_token: ${{ secrets.GITHUB_TOKEN }}

It runs linting with a new --pipeline-output flag that renders out nice markdown and then adds the report as a comment on the PR.

daveshanley avatar Jun 06 '25 18:06 daveshanley

The doctor will be a GitHub App + Action, as there will be more complex work going on under the covers, but this simple action works out of the box.

daveshanley avatar Jun 06 '25 18:06 daveshanley

The github action is now in play: https://quobix.com/vacuum/github-action/

It can be found in the market place: https://github.com/marketplace/actions/vacuum-openapi-linter-and-quality-analysis-tool

daveshanley avatar Jun 08 '25 20:06 daveshanley

Awesome thanks! Will take it for a spin today 🙏

hughsimpson avatar Jun 09 '25 10:06 hughsimpson