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

chore: Lint eco system error #4275

Merged
merged 8 commits into from Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/scripts/lint-ecosystem.js
Expand Up @@ -34,7 +34,7 @@ module.exports = async function ({ core }) {
}

const moduleNameTest = moduleNameRegex.exec(line)

if (moduleNameTest === null)
{
core.error(`line ${lineNumber}: improper pattern, module name should be enclosed with backticks`)
Expand All @@ -52,13 +52,20 @@ module.exports = async function ({ core }) {
modules.push(moduleName)
}

const failures = [];
if (hasOutOfOrderItem === true) {
core.setFailed('Some ecosystem modules are not in alphabetical order.')
const failure = 'Some ecosystem modules are not in alphabetical order.'
failures.push(failure)
core.setFailed(failure)
}

if (hasImproperFormat === true) {
core.setFailed('Some ecosystem modules are improperly formatted.')
const failure = 'Some ecosystem modules are improperly formatted.'
failures.push(failure)
core.setFailed(failure)
}

return { failures }
}

function compare(current, previous) {
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/lint-ecosystem-order.yml
Expand Up @@ -30,5 +30,19 @@ jobs:
with:
script: |
const script = require('./.github/scripts/lint-ecosystem.js')
await script({ core })
const result = await script({ core })
zrosenbauer marked this conversation as resolved.
Show resolved Hide resolved

const output = `
## :x: Failed: Lint Ecosystem Order

${result.failures.map((failure) => '- ' + failure + '\n')}

[View Details](https://github.com/fastify/fastify/actions/runs/${context.runId}/jobs/${context.job})
`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
4 changes: 2 additions & 2 deletions docs/Guides/Ecosystem.md
Expand Up @@ -16,8 +16,6 @@ section.
multiple schemas and decide which one to use to serialize the payload
- [`@fastify/auth`](https://github.com/fastify/fastify-auth) Run multiple auth
functions in Fastify.
- [`@fastify/autoload`](https://github.com/fastify/fastify-autoload) Require all
plugins in a directory.
- [`@fastify/awilix`](https://github.com/fastify/fastify-awilix) Dependency
injection support for Fastify, based on
[awilix](https://github.com/jeffijoe/awilix).
Expand Down Expand Up @@ -133,6 +131,8 @@ section.
rendering (_ejs, pug, handlebars, marko_) plugin support for Fastify.
- [`@fastify/websocket`](https://github.com/fastify/fastify-websocket) WebSocket
support for Fastify. Built upon [ws](https://github.com/websockets/ws).
- [`@fastify/autoload`](https://github.com/fastify/fastify-autoload) Require all
plugins in a directory.

#### [Community](#community)

Expand Down