Skip to content

Commit

Permalink
feat: update to use new workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Newton <[email protected]>
  • Loading branch information
iamnewton committed Oct 28, 2024
1 parent e637815 commit 7153bcf
Show file tree
Hide file tree
Showing 17 changed files with 18,850 additions and 13,619 deletions.
20 changes: 20 additions & 0 deletions .editorconfig-checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Version": "v3.0.3",
"Verbose": false,
"Format": "",
"Debug": false,
"IgnoreDefaults": false,
"SpacesAftertabs": false,
"NoColor": false,
"Exclude": ["^LICENSE$", "^public/.*"],
"AllowedContentTypes": [],
"PassedFiles": [],
"Disable": {
"EndOfLine": false,
"Indentation": false,
"InsertFinalNewline": false,
"TrimTrailingWhitespace": false,
"IndentSize": false,
"MaxLineLength": false
}
}
33 changes: 23 additions & 10 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
# Add 'docs' label to any changes within 'docs' folder or any subfolders
# Add 'docs' label to any change to .md files within the entire repository
# Add "documentation" label to any changes within "docs" folder or any subfolders or .md files within the entire repository
documentation:
- changed-files:
- any-glob-to-any-file:
- docs/**
- '**/*.md'
- any:
- changed-files:
- any-glob-to-any-file:
- docs/**
- "**/*.md"

# Add 'bug' label to any PR where the head branch name starts with `fix` or has a `fix` section in the name
# Add "bug" label to any PR where the head branch name starts with `fix` with file changes to src directory
bug:
- head-branch: ['^fix', 'fix']
- all:
- changed-files:
- any-glob-to-any-file: src/**
- head-branch: "^fix-"

# Add 'enhancement' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
# Add "enhancement" label to any PR where the head branch name starts with `feat` with file changes to src directory
enhancement:
- head-branch: ['^feat', 'feature']
- all:
- changed-files:
- any-glob-to-any-file: src/**
- head-branch: "^feat-"

# Add "release" label to any PR that is opened against the `main` branch
release:
- all:
- changed-files:
- any-glob-to-any-file: .changeset/*
- base-branch: "main"
32 changes: 32 additions & 0 deletions .github/workflows/bookkeeping-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PR Bookkeeping

# @TODO: add in more things like:
# - [ ] auto-assigning,
# - [ ] project assignments,
# - [ ] milestone assignments
# - [ ] cleans up language
# - [ ] checks that template is filled out

on: # yamllint disable-line rule:truthy
pull_request:
types:
- opened
- edited

permissions:
contents: read
pull-requests: write

jobs:
label-pr:
name: Add Labels to PRs
runs-on: ubuntu-latest
steps:
- uses: github/[email protected]
with:
include-title: 1
include-body: 0
sync-labels: 1
configuration-path: .github/labeler.yml
enable-versioned-regex: 0
repo-token: ${{ github.token }}
15 changes: 0 additions & 15 deletions .github/workflows/label.yml

This file was deleted.

96 changes: 96 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Lint

on: # yamllint disable-line rule:truthy
- push
- pull_request

permissions:
contents: read

jobs:
super-lint:
name: "Lint entire codebase"
permissions:
contents: write # write linting fixes
statuses: write # write Super-linter status checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repository
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x

- run: npm ci
name: Install dependencies

- uses: super-linter/super-linter/[email protected]
name: Run Super Linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ANNOTATE_ONLY: true # Allow annotations in the PR
DISABLE_COMMENTS: false # Enable comments in the PR
IGNORE_GITIGNORED_FILES: true
LINTER_RULES_PATH: /
# CSS_FILE_NAME: "stylelint.config.js"
EDITORCONFIG_FILE_NAME: ".editorconfig-checker.json"
# FIX_CSS_PRETTIER: true
FIX_ENV: true
FIX_GRAPHQL_PRETTIER: true
FIX_HTML_PRETTIER: true
FIX_JAVASCRIPT_PRETTIER: true
# FIX_JSON_PRETTIER: true => turning this off til i figure out why its not respecting config
FIX_JSX_PRETTIER: true
FIX_MARKDOWN_PRETTIER: true
FIX_TSX: true
FIX_TYPESCRIPT_PRETTIER: true
# FIX_YAML_PRETTIER: true => turning this off til i figure out why its not respecting config
# GITHUB_ACTIONS_CONFIG_FILE: "actionlint.yml" => basically unneeded
# GITLEAKS_CONFIG: ".gitleaks.toml" # Path to your Gitleaks config if you have one
JAVASCRIPT_ES_CONFIG_FILE: "eslint.config.js"
# MARKDOWN_CONFIG_FILE: ".markdown-lint.yml"
# NATURAL_LANGUAGE_CONFIG_FILE: "textlint.config.js"
PRETTIER_CONFIG: "prettier.config.js"
TYPESCRIPT_ES_CONFIG_FILE: "eslint.config.js"
TYPESCRIPT_STANDARD_TSCONFIG_FILE: "tsconfig.json"
# VALIDATE_CSS_PRETTIER: true
VALIDATE_DOCKERFILE: true
VALIDATE_EDITORCONFIG: true
VALIDATE_ENV: true
VALIDATE_GIT_COMMITLINT: true
VALIDATE_GIT_MERGE_CONFLICT_MARKERS: true
VALIDATE_GITHUB_ACTIONS: true
VALIDATE_GITLEAKS: true
VALIDATE_GRAPHQL_PRETTIER: true
VALIDATE_HTML_PRETTIER: true
VALIDATE_JAVASCRIPT_PRETTIER: true
VALIDATE_JSON_PRETTIER: true
VALIDATE_JSX_PRETTIER: true
VALIDATE_MARKDOWN_PRETTIER: true
# VALIDATE_NATURAL_LANGUAGE: true
VALIDATE_TSX: true
VALIDATE_TYPESCRIPT_PRETTIER: true
VALIDATE_YAML: true # turning on for now while prettier is broken
# VALIDATE_YAML_PRETTIER: true => turning it off because its writing 4 spaces instead of 2
YAML_CONFIG_FILE: "yamllint.config.yml"

- uses: stefanzweifel/git-auto-commit-action@v5
name: Commit and push linting fixes
# Run only on:
# - Pull requests
# - Not on the default branch
if: >
github.event_name == 'pull_request' &&
github.ref_name != github.event.repository.default_branch
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "chore: fix linting issues"
commit_options: "--no-verify --signoff"
commit_user_name: super-linter
commit_user_email: [email protected]
71 changes: 71 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Publish

on: # yamllint disable-line rule:truthy
push:
branches:
- main

permissions:
contents: write
packages: write
pull-requests: write

jobs:
release:
name: Version using Semantic Versioning
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: node
# The short ref name of the branch or tag that triggered
# the workflow run. For example, `main` or `1.x`
target-branch: ${{ github.ref_name }}

publish-npm:
name: Publish to NPM
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v4
name: Checkout repository

- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x
registry-url: 'https://registry.npmjs.org'

- run: npm ci
name: Install dependencies

- run: npm publish
name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-gh:
name: Publish to GitHub
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v4
name: Checkout repository

- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x
registry-url: 'https://npm.pkg.github.com'
scope: '@theholocron'

- run: npm ci
name: Install dependencies

- run: npm publish --access public
name: Publish to GitHub Packages
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
38 changes: 0 additions & 38 deletions .github/workflows/release.yml

This file was deleted.

72 changes: 72 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Review

on: # yamllint disable-line rule:truthy
- push
- pull_request

jobs:
reviewdog:
name: Review PRs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout repository

- uses: actions/setup-node@v4
name: Setup Node.js @v20
with:
cache: npm
node-version: 20.x

- run: npm ci
name: Install dependencies

- uses: reviewdog/action-setup@v1
name: Install & setup ReviewDog
with:
reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z]

- uses: reviewdog/action-gitleaks@v1
name: Detect secrets using Gitleaks
with:
reporter: github-pr-check

- uses: reviewdog/action-alex@v1
name: Check language using Alex
with:
reporter: github-pr-check # [github-pr-check,github-check,github-pr-review]
# GitHub Status Check won't become failure with warning.
# level: warning # [info,warning, error]

- uses: EPMatt/reviewdog-action-tsc@v1
name: Check types using TypeScript
with:
reporter: github-pr-check

# - uses: reviewdog/action-stylelint@v1
# name: Check CSS using StyleLint
# with:
# reporter: github-pr-check
# stylelint_input: '**/*.css'

# need to setup textlint in the repo for this
# - uses: tsuyoshicho/action-textlint@v3
# name: Check text using TextLint
# with:
# reporter: github-pr-check

- uses: reviewdog/action-actionlint@v1
name: Check GitHub Actions using ActionLint
with:
reporter: github-pr-check

- uses: dotenv-linter/action-dotenv-linter@v2
name: Check environment variables using dotenv
with:
reporter: github-code-suggestions

- uses: reviewdog/action-yamllint@v1
name: Check YAML using YamlLint
with:
reporter: github-pr-check
yamllint_flags: "-c ${{ github.workspace }}/yamllint.config.yml ${{ github.workspace }}"
Loading

0 comments on commit 7153bcf

Please sign in to comment.