Skip to content

Commit

Permalink
chore(template): sync with ahmadnassri/template-node-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Aug 25, 2022
1 parent 11d079f commit 973afd4
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 26 deletions.
11 changes: 11 additions & 0 deletions .github/linters/.checkov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ------------------------------------------------------------- #
# Note: this file is automatically managed in template-template #
# ------------------------------------------------------------- #

quiet: true
skip-check:
- CKV_DOCKER_2
- CKV_GHA_3
- BC_DKR_3
- CKV_GIT_1
- CKV_GIT_5
25 changes: 25 additions & 0 deletions .github/linters/.mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ------------------------------------------------------------- #
# Note: this file is automatically managed in template-template #
# ------------------------------------------------------------- #

ENABLE: ACTION,BASH,MAKEFILE,REPOSITORY,TERRAFORM,HTML,ENV,JAVASCRIPT,JSX,EDITORCONFIG,JSON,DOCKERFILE,MARKDOWN,YAML,CSS,OPENAPI,SQL
DISABLE_LINTERS:
- JSON_PRETTIER
- JAVASCRIPT_PRETTIER
- YAML_PRETTIER
- REPOSITORY_TRIVY
- REPOSITORY_DEVSKIM
- TERRAFORM_CHECKOV

CONFIG_REPORTER: false
FAIL_IF_MISSING_LINTER_IN_FLAVOR: true
FLAVOR_SUGGESTIONS: false
LOG_LEVEL: INFO
MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdown-lint.yml
PRINT_ALPACA: false
SHOW_ELAPSED_TIME: true
VALIDATE_ALL_CODEBASE: false
IGNORE_GENERATED_FILES: true
FILTER_REGEX_EXCLUDE: (dist/*|README.md|test/fixtures/*)

DISABLE_ERRORS: true # TODO: disable once https://github.com/oxsecurity/megalinter/pull/1798 is merged
17 changes: 17 additions & 0 deletions .github/linters/.yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ------------------------------------------------------------- #
# Note: this file is automatically managed in template-template #
# ------------------------------------------------------------- #

extends: default

rules:
brackets:
max-spaces-inside: 1
document-start:
present: false
truthy:
check-keys: false
line-length:
max: 500
comments:
min-spaces-from-content: 1
3 changes: 3 additions & 0 deletions .github/workflows/pull_request_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ permissions:
pull-requests: write
contents: write

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}

jobs:
metadata:
runs-on: ubuntu-latest
Expand Down
35 changes: 20 additions & 15 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:

name: push

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}

jobs:
metadata:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -40,24 +43,28 @@ jobs:
with:
config: .github/linters/.commit-lint.yml

super-linter:
mega-linter:
timeout-minutes: 5

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/[email protected]

- uses: github/super-linter/slim@v4
- uses: oxsecurity/megalinter/flavors/javascript@v6
env:
LOG_LEVEL: ERROR
VALIDATE_JSCPD: 'false'
VALIDATE_ALL_CODEBASE: 'false'
IGNORE_GITIGNORED_FILES: 'true'
FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*'
GITHUB_TOKEN: ${{ github.token }}
MEGALINTER_CONFIG: .github/linters/.mega-linter.yml
GITHUB_COMMENT_REPORTER: true
GITHUB_STATUS_REPORTER: true

- uses: actions/upload-artifact@v2
if: ${{ success() }} || ${{ failure() }}
with:
name: mega-linter-reports
path: |
megalinter-reports
mega-linter.log
npm-audit:
timeout-minutes: 5
Expand Down Expand Up @@ -122,7 +129,7 @@ jobs:
- metadata
- test-run
- commit-lint
- super-linter
- mega-linter

# only runs on main branch for non template repos
if: |
Expand Down Expand Up @@ -250,7 +257,7 @@ jobs:
- metadata
- test-run
- commit-lint
- super-linter
- mega-linter

# only runs on main branch for template repos
if: |
Expand All @@ -260,10 +267,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: ahmadnassri/[email protected]

- uses: actions/checkout@v3

- uses: ahmadnassri/action-template-repository-sync@v1.6.0
- uses: ahmadnassri/action-template-repository-sync@v2
with:
github-token: ${{ secrets.GH_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ help: ## display this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

.DEFAULT_GOAL := help
.PHONY: build test help
.PHONY: help all clean test
18 changes: 8 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
# ----------------------------------------------- #

services:
# ---- super-linter ---- #
# ---- mega-linter ---- #
lint:
profiles: ["dev"]
image: github/super-linter:slim-v4
image: oxsecurity/megalinter-javascript:v6
volumes:
- ./:/github/workspace
- ./:/tmp/lint
environment:
RUN_LOCAL: 'true'
LOG_LEVEL: 'ERROR'
MULTI_STATUS: 'false'
IGNORE_GITIGNORED_FILES: 'true'
DEFAULT_WORKSPACE: /github/workspace
FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*'
MEGALINTER_CONFIG: .github/linters/.mega-linter.yml
REPORT_OUTPUT_FOLDER: none
VALIDATE_ALL_CODEBASE: true

# ---- readme generator ---- #
readme:
Expand All @@ -34,12 +31,13 @@ services:
source: .
target: /app
working_dir: /app
command: npm --no-update-notifier run test -- --reporter=classic
command: npm --no-update-notifier run start

test:
<<: *app
profiles: ["test"]
image: node:alpine
command: npm --no-update-notifier run test -- --reporter=classic
depends_on:
- node14
- node16
Expand Down

0 comments on commit 973afd4

Please sign in to comment.