Skip to content

Commit

Permalink
ci: adopt template-node-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed Dec 19, 2022
1 parent a58893e commit 42b5205
Show file tree
Hide file tree
Showing 26 changed files with 1,031 additions and 117 deletions.
17 changes: 0 additions & 17 deletions .codeclimate.yml

This file was deleted.

8 changes: 7 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# http://editorconfig.org
# ----------------------------------------------- #
# Note: this file originates in template-template #
# ----------------------------------------------- #

root = true

[*]
Expand All @@ -11,3 +14,6 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
5 changes: 5 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ----------------------------------------------- #
# Note: this file originates in template-template #
# ----------------------------------------------- #

github: [ahmadnassri]
41 changes: 41 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ----------------------------------------------- #
# Note: this file originates in template-node-lib #
# ----------------------------------------------- #

version: 2
updates:
- package-ecosystem: npm
open-pull-requests-limit: 10
directory: /
commit-message:
prefix: build
prefix-development: chore
include: scope
schedule:
interval: daily
time: "10:00"
timezone: America/Toronto

- package-ecosystem: gitsubmodule
open-pull-requests-limit: 10
directory: /
commit-message:
prefix: build
prefix-development: chore
include: scope
schedule:
interval: daily
time: "10:00"
timezone: America/Toronto

- package-ecosystem: docker
open-pull-requests-limit: 10
directory: /
commit-message:
prefix: build
prefix-development: chore
include: scope
schedule:
interval: daily
time: "10:00"
timezone: America/Toronto
12 changes: 12 additions & 0 deletions .github/linters/.checkov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ----------------------------------------------- #
# Note: this file originates in template-template #
# ----------------------------------------------- #

quiet: true
skip-check:
- CKV_DOCKER_2
- CKV_GHA_3
- BC_DKR_3
- CKV_GIT_1
- CKV_GIT_5
- CKV_GIT_6
9 changes: 9 additions & 0 deletions .github/linters/.commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ----------------------------------------------- #
# Note: this file originates in template-template #
# ----------------------------------------------- #

extends:
- "@commitlint/config-conventional"

rules:
body-max-line-length: [2, "always", 200]
156 changes: 156 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# ----------------------------------------------- #
# Note: this file originates in template-template #
# ----------------------------------------------- #

# Heading levels should only increment by one level at a time
MD001: false

# Heading style
MD003:
style: atx

# Unordered list style
MD004:
style: dash

# Inconsistent indentation for list items at the same level
MD005: true

# Unordered list indentation
MD007:
indent: 2
start_indented: false

# Trailing spaces
MD009:
br_spaces: 2
list_item_empty_lines: false
strict: false

# Hard tabs
MD010:
code_blocks: false

# Reversed link syntax
MD011: true

# Multiple consecutive blank lines
MD012:
maximum: 1

# Line length
MD013:
line_length: 360
strict: true
stern: true

# Dollar signs used before commands without showing output
MD014: false

# No space after hash on atx style heading
MD018: true

# Multiple spaces after hash on atx style heading
MD019: true

# No space inside hashes on closed atx style heading
MD020: true

# Multiple spaces inside hashes on closed atx style heading
MD021: true

# Headings should be surrounded by blank lines
MD022:
lines_above: 1
lines_below: 1

# Headings must start at the beginning of the line
MD023: true

# Multiple headings with the same content
MD024:
allow_different_nesting: true

# Multiple top level headings in the same document
MD025: true

# Trailing punctuation in heading
MD026:
punctuation: ".,;:!?。,;:!?"

# Multiple spaces after blockquote symbol
MD027: true

# Blank line inside blockquote
MD028: true

# Ordered list item prefix
MD029:
style: one_or_ordered

# Spaces after list markers
MD030:
ul_single: 1
ol_single: 1
ul_multi: 1
ol_multi: 1

# Fenced code blocks should be surrounded by blank lines
MD031:
list_items: true

# Lists should be surrounded by blank lines
MD032: true

# inline HTML
MD033:
allowed_elements: [details, summary]

# Bare URL used
MD034: true

# Horizontal rule style
MD035:
style: "----"

# Emphasis used instead of a heading
MD036:
punctuation: ".,;:!?。,;:!?"

# Spaces inside emphasis markers
MD037: true

# Spaces inside code span elements
MD038: true

# Spaces inside link text
MD039: true

# Fenced code blocks should have a language specified
MD040: true

# First line in file should be a top level heading
MD041: false

# No empty links
MD042: true

# Required heading structure
MD043: false

# Proper names should have the correct capitalization
MD044: false

# Images should have alternate text (alt text)
MD045: false

# Code block style
MD046:
style: fenced

# Files should end with a single newline character
MD047: true

# Code fence style
MD048:
style: backtick
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 originates in template-template #
# ----------------------------------------------- #

DISABLE:
- COPYPASTE

DISABLE_LINTERS:
- REPOSITORY_TRIVY
- SPELL_CSPELL
- JSON_PRETTIER
- YAML_PRETTIER
- JAVASCRIPT_PRETTIER

LOG_LEVEL: INFO
PRINT_ALPACA: false
CONFIG_REPORTER: false
SHOW_ELAPSED_TIME: true
FLAVOR_SUGGESTIONS: false
VALIDATE_ALL_CODEBASE: false
IGNORE_GENERATED_FILES: true
FILTER_REGEX_EXCLUDE: (dist/*|README.md|test/fixtures/*|vendor/*|/schemas/*)

MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdown-lint.yml
REPOSITORY_CHECKOV_ARGUMENTS: [--skip-path, schemas]
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 originates 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
4 changes: 4 additions & 0 deletions .github/test-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"os": ["ubuntu-latest"],
"node-version": [14, 16, 18]
}
77 changes: 77 additions & 0 deletions .github/workflows/pull_request_target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# ----------------------------------------------- #
# Note: this file originates in template-template #
# ----------------------------------------------- #

on: pull_request_target

name: pull_request_target

permissions:
pull-requests: write
contents: write

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

jobs:
metadata:
runs-on: ubuntu-latest

outputs:
repository_is_template: ${{ steps.metadata.outputs.repository_is_template }}

steps:
- uses: actions/checkout@v3.2.0

- uses: ahmadnassri/action-metadata@v2.1.2
id: metadata

auto-merge:
timeout-minutes: 5

runs-on: ubuntu-latest

# only run for dependabot PRs
if: ${{ github.actor == 'dependabot[bot]' }}

steps:
- id: dependabot
uses: dependabot/fetch-metadata@v1.3.5
with:
github-token: ${{ github.token }}

- name: auto merge conditions
id: auto-merge
if: |
contains('version-update:semver-minor,version-update:semver-patch', steps.dependabot.outputs.update-type) &&
contains('direct:development,indirect:development,direct:production,indirect:production', steps.dependabot.outputs.dependency-type)
run: echo "::notice ::auto-merge conditions satisfied"

- name: auto approve pr
if: ${{ steps.auto-merge.conclusion == 'success' }}
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --rebase "$PR_URL"
template-sync:
needs: metadata

timeout-minutes: 20

runs-on: ubuntu-latest

# only run for templates
if: ${{ needs.metadata.outputs.repository_is_template == 'true' }}

steps:
- uses: actions/checkout@v3.2.0
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: ahmadnassri/action-template-repository-sync@v2.3.1
with:
github-token: ${{ secrets.GH_TOKEN }}

0 comments on commit 42b5205

Please sign in to comment.