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

feat(formatters): add GitHub Actions formatter #2508

Merged
merged 13 commits into from
Jul 26, 2023

Conversation

siketyan
Copy link
Contributor

@siketyan siketyan commented Jul 13, 2023

This pull requests add a built-in formatter for annotating errors in GitHub Actions.

Spectral already have spectral-action for running Spectral and annotating errors in the workflow. The action creates a new check entry to annotate, but sometimes the annotation is incorrectly attached to another job due to GitHub's bug. To avoid that, it would be great if the Spectral CLI support formatting errors to GitHub Actions format 1 as a built-in formatter, as same as TeamCity formatter does.

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

Screenshots

N/A

Additional context

N/A

Footnotes

  1. https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message

@siketyan siketyan requested review from a team as code owners July 13, 2023 07:31
@siketyan siketyan changed the title feat: Add GitHub Actions formatter feat(formatter): Add GitHub Actions formatter Jul 13, 2023
@siketyan siketyan changed the title feat(formatter): Add GitHub Actions formatter feat(formatter): add GitHub Actions formatter Jul 13, 2023
@siketyan siketyan changed the title feat(formatter): add GitHub Actions formatter feat(formatters): add GitHub Actions formatter Jul 13, 2023
@siketyan siketyan force-pushed the feat/github-actions-formatter branch 2 times, most recently from e91eeb4 to f4c90b2 Compare July 13, 2023 07:47
@siketyan siketyan force-pushed the feat/github-actions-formatter branch from f4c90b2 to 3295bd4 Compare July 13, 2023 08:03
@siketyan siketyan requested a review from P0lip July 16, 2023 14:00
@P0lip
Copy link
Contributor

P0lip commented Jul 24, 2023

I'll try to take a look at it this week!

Copy link
Contributor

@P0lip P0lip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than a potential column mismatch, this looks great.
Thanks a lot for the contribution!

packages/formatters/src/github-actions.ts Outdated Show resolved Hide resolved
packages/formatters/src/github-actions.ts Outdated Show resolved Hide resolved
packages/formatters/src/github-actions.ts Outdated Show resolved Hide resolved
@P0lip P0lip added the enhancement New feature or request label Jul 24, 2023
@siketyan siketyan force-pushed the feat/github-actions-formatter branch from 77cddc0 to 0b0c635 Compare July 25, 2023 15:03
@siketyan siketyan requested a review from P0lip July 25, 2023 15:10
Copy link
Contributor

@P0lip P0lip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks again!
I'll merge and release it today

@P0lip
Copy link
Contributor

P0lip commented Jul 25, 2023

Could you merge the latest develop branch? it's out of sync with the base branch

@siketyan
Copy link
Contributor Author

@P0lip merged, sorry for the delay; I was in the dream 💤

@P0lip P0lip enabled auto-merge (squash) July 26, 2023 09:37
@P0lip P0lip disabled auto-merge July 26, 2023 09:41
@P0lip P0lip merged commit b350511 into stoplightio:develop Jul 26, 2023
2 checks passed
P0lip pushed a commit that referenced this pull request Jul 26, 2023
stoplight-bot pushed a commit that referenced this pull request Jul 26, 2023
# @stoplight/spectral-formatters [1.2.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-formatters-1.1.0...@stoplight/spectral-formatters-1.2.0) (2023-07-26)

### Features

* **formatters:** add GitHub Actions formatter ([#2508](#2508)) ([6904927](6904927))
@siketyan siketyan deleted the feat/github-actions-formatter branch July 26, 2023 10:14
stoplight-bot pushed a commit that referenced this pull request Jun 7, 2024
# [1.8.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-functions-v1.7.2...@stoplight/spectral-functions-1.8.0) (2024-06-07)

### Bug Fixes

* **cli:** choose proxy agent based on requester protocol ([#2521](#2521)) ([056f2e1](056f2e1))
* **cli:** clarify usage of --format ([#2575](#2575)) ([96eee89](96eee89))
* **core:** dedupe paths containing special characters correctly ([758de21](758de21))
* **core:** invalid then produced by Rule#toJSON ([#2496](#2496)) ([db91553](db91553))
* **core:** more accurate ruleset error paths ([66b3ca7](66b3ca7))
* **core:** pointer in overrides are applied too broadly ([#2511](#2511)) ([69403c1](69403c1))
* **core:** reset path in fn context ([#2389](#2389)) ([3d47ec4](3d47ec4))
* **parsers:** update @stoplight/json from ~3.20.1 to ~3.21.0 ([e906d20](e906d20))
* **parsers:** update @stoplight/yaml from ~4.2.3 to ~4.3.0 ([91fdded](91fdded))
* **ref-resolver:** bump @stoplight/json-ref-resolver from ~3.1.4 to ~3.1.5 ([#3635](https://github.com/stoplightio/spectral/issues/3635)) ([215ae93](215ae93))
* **ref-resolver:** update @stoplight/json-ref-resolver from ~3.1.5 to ~3.1.6 ([6f73151](6f73151))
* **ruleset-bundler:** defaults should be last one ([#2403](#2403)) ([8780cfa](8780cfa))
* **ruleset-bundler:** remove extraneous 'external dependency' warnings ([#2475](#2475)) ([e791534](e791534))
* **ruleset-migrator:** correct package.json's browser field ([#2497](#2497)) ([89a6a67](89a6a67))
* **ruleset-migrator:** transform functions under overrides ([#2459](#2459)) ([45e817f](45e817f))
* **ruleset-migrator:** update @stoplight/json from ~3.20.1 to ~3.21.0 ([3f7eebc](3f7eebc))
* **ruleset-migrator:** use module for require.resolve ([#2405](#2405)) ([d7c0fa4](d7c0fa4))
* **rulesets:** avoid false errors from ajv ([#2408](#2408)) ([92dab78](92dab78))
* **rulesets:** example validation for required readOnly and writeOnly properties ([#2573](#2573)) ([ae1fea5](ae1fea5))
* **rulesets:** oasExample should clean id fields from non-schema objects ([#2561](#2561)) ([7f7583e](7f7583e))
* **rulesets:** tweak server variables function ([#2533](#2533)) ([244cbda](244cbda))

### Features

* **cli:** add sarif formatter ([#2532](#2532)) ([959a86a](959a86a))
* **cli:** require newer version of all Spectral dependencies ([10ddd97](10ddd97))
* **cli:** use hpagent ([#2513](#2513)) ([9b2d347](9b2d347))
* **core:** relax formats validation ([#2151](#2151)) ([de16b4c](de16b4c))
* **core:** support x- extensions in the ruleset ([#2440](#2440)) ([964151e](964151e))
* **formats:** jsonSchemaLoose format should search for enum keyword ([#2551](#2551)) ([0835545](0835545))
* **formats:** support AsyncAPI 2.6.0 ([#2391](#2391)) ([b8e51b4](b8e51b4))
* **formatters:** add export entrypoint for utils ([#2482](#2482)) ([d4b883c](d4b883c))
* **formatters:** add GitHub Actions formatter ([#2508](#2508)) ([6904927](6904927))
* **formatters:** add sarif formatter ([#2532](#2532)) ([908c308](908c308))
* **formatters:** move formatters to a separate package ([#2468](#2468)) ([664e259](664e259))
* **rulesets:** add multiple xor ([#2614](#2614)) ([af9c742](af9c742))
* **rulesets:** add new rule that requires sibling items field for type array ([#2632](#2632)) ([24198bc](24198bc))
* **rulesets:** add oas3_1-servers-in-webhook and oas3_1-callbacks-in… ([#2581](#2581)) ([7a8cc0e](7a8cc0e))
* **rulesets:** add oas3-server-variables rule ([#2526](#2526)) ([4c4de85](4c4de85))
* **rulesets:** add scope validation to oas{2,3}-operation-security-defined rules ([#2538](#2538)) ([68aacd6](68aacd6))
* **rulesets:** add traits array path to headers rule ([#2460](#2460)) ([9ceabca](9ceabca))
* **rulesets:** improve {oas2,oas3}-valid-schema rule ([#2574](#2574)) ([8df2c36](8df2c36))
* **rulesets:** support AsyncAPI 2.6.0 ([#2391](#2391)) ([94a7801](94a7801))
stoplight-bot pushed a commit that referenced this pull request Sep 12, 2024
# [1.19.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-core-1.18.3...@stoplight/spectral-core-1.19.0) (2024-09-12)

### Bug Fixes

* **cli:** choose proxy agent based on requester protocol ([#2521](#2521)) ([056f2e1](056f2e1))
* **cli:** clarify usage of --format ([#2575](#2575)) ([96eee89](96eee89))
* **parsers:** update @stoplight/yaml from ~4.2.3 to ~4.3.0 ([91fdded](91fdded))
* **repo:** remove discord link and fix typo in github bug template ([#2642](#2642)) ([048924d](048924d))
* **ruleset-migrator:** update @stoplight/json from ~3.20.1 to ~3.21.0 ([3f7eebc](3f7eebc))
* **rulesets:** example validation for required readOnly and writeOnly properties ([#2573](#2573)) ([ae1fea5](ae1fea5))
* **rulesets:** fixed array-items type property selector ([#2638](#2638)) ([0845fb5](0845fb5))
* **rulesets:** oasExample should clean id fields from non-schema objects ([#2561](#2561)) ([7f7583e](7f7583e))
* **rulesets:** tweak server variables function ([#2533](#2533)) ([244cbda](244cbda))

### Features

* **cli:** add sarif formatter ([#2532](#2532)) ([959a86a](959a86a))
* **cli:** require newer version of all Spectral dependencies ([10ddd97](10ddd97))
* **cli:** use hpagent ([#2513](#2513)) ([9b2d347](9b2d347))
* **formats:** add arazzo format ([#2663](#2663)) ([dc1a8ef](dc1a8ef))
* **formats:** jsonSchemaLoose format should search for enum keyword ([#2551](#2551)) ([0835545](0835545))
* **formatters:** add GitHub Actions formatter ([#2508](#2508)) ([6904927](6904927))
* **formatters:** add sarif formatter ([#2532](#2532)) ([908c308](908c308))
* **rulesets:** add multiple xor ([#2614](#2614)) ([af9c742](af9c742))
* **rulesets:** add new rule that requires sibling items field for type array ([#2632](#2632)) ([24198bc](24198bc))
* **rulesets:** add oas3_1-servers-in-webhook and oas3_1-callbacks-in… ([#2581](#2581)) ([7a8cc0e](7a8cc0e))
* **rulesets:** add oas3-server-variables rule ([#2526](#2526)) ([4c4de85](4c4de85))
* **rulesets:** add scope validation to oas{2,3}-operation-security-defined rules ([#2538](#2538)) ([68aacd6](68aacd6))
* **rulesets:** improve {oas2,oas3}-valid-schema rule ([#2574](#2574)) ([8df2c36](8df2c36))
* **rulesets:** initial rulesets for the Arazzo Specification ([#2672](#2672)) ([8443232](8443232))
stoplight-bot pushed a commit that referenced this pull request Sep 12, 2024
# [1.6.0](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-ruleset-bundler-v1.5.2...@stoplight/spectral-ruleset-bundler-1.6.0) (2024-09-12)

### Bug Fixes

* **cli:** choose proxy agent based on requester protocol ([#2521](#2521)) ([056f2e1](056f2e1))
* **cli:** clarify usage of --format ([#2575](#2575)) ([96eee89](96eee89))
* **core:** dedupe paths containing special characters correctly ([758de21](758de21))
* **core:** invalid then produced by Rule#toJSON ([#2496](#2496)) ([db91553](db91553))
* **core:** pointer in overrides are applied too broadly ([#2511](#2511)) ([69403c1](69403c1))
* **parsers:** update @stoplight/json from ~3.20.1 to ~3.21.0 ([e906d20](e906d20))
* **parsers:** update @stoplight/yaml from ~4.2.3 to ~4.3.0 ([91fdded](91fdded))
* **ref-resolver:** update @stoplight/json-ref-resolver from ~3.1.5 to ~3.1.6 ([6f73151](6f73151))
* **repo:** remove discord link and fix typo in github bug template ([#2642](#2642)) ([048924d](048924d))
* **ruleset-migrator:** correct package.json's browser field ([#2497](#2497)) ([89a6a67](89a6a67))
* **ruleset-migrator:** update @stoplight/json from ~3.20.1 to ~3.21.0 ([3f7eebc](3f7eebc))
* **rulesets:** example validation for required readOnly and writeOnly properties ([#2573](#2573)) ([ae1fea5](ae1fea5))
* **rulesets:** fixed array-items type property selector ([#2638](#2638)) ([0845fb5](0845fb5))
* **rulesets:** oasExample should clean id fields from non-schema objects ([#2561](#2561)) ([7f7583e](7f7583e))
* **rulesets:** tweak server variables function ([#2533](#2533)) ([244cbda](244cbda))

### Features

* **cli:** add sarif formatter ([#2532](#2532)) ([959a86a](959a86a))
* **cli:** require newer version of all Spectral dependencies ([10ddd97](10ddd97))
* **cli:** use hpagent ([#2513](#2513)) ([9b2d347](9b2d347))
* **formats:** add arazzo format ([#2663](#2663)) ([dc1a8ef](dc1a8ef))
* **formats:** jsonSchemaLoose format should search for enum keyword ([#2551](#2551)) ([0835545](0835545))
* **formatters:** add export entrypoint for utils ([#2482](#2482)) ([d4b883c](d4b883c))
* **formatters:** add GitHub Actions formatter ([#2508](#2508)) ([6904927](6904927))
* **formatters:** add sarif formatter ([#2532](#2532)) ([908c308](908c308))
* **formatters:** move formatters to a separate package ([#2468](#2468)) ([664e259](664e259))
* **rulesets:** add multiple xor ([#2614](#2614)) ([af9c742](af9c742))
* **rulesets:** add new rule that requires sibling items field for type array ([#2632](#2632)) ([24198bc](24198bc))
* **rulesets:** add oas3_1-servers-in-webhook and oas3_1-callbacks-in… ([#2581](#2581)) ([7a8cc0e](7a8cc0e))
* **rulesets:** add oas3-server-variables rule ([#2526](#2526)) ([4c4de85](4c4de85))
* **rulesets:** add scope validation to oas{2,3}-operation-security-defined rules ([#2538](#2538)) ([68aacd6](68aacd6))
* **rulesets:** improve {oas2,oas3}-valid-schema rule ([#2574](#2574)) ([8df2c36](8df2c36))
* **rulesets:** initial rulesets for the Arazzo Specification ([#2672](#2672)) ([8443232](8443232))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants