Skip to content

Commit

Permalink
chore(actions): add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukaato committed Aug 2, 2024
1 parent d254e3a commit d5c163e
Show file tree
Hide file tree
Showing 10 changed files with 1,483 additions and 5 deletions.
69 changes: 69 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: 🐛 Bug Report
description: Create a report to help us improve stencil-sass-alias
title: 'bug: '

body:
- type: checkboxes
id: prerequisites
attributes:
label: Prerequisites
description: Please ensure you have completed all of the following.
options:
- label: I have read the [Contributing Guidelines](https://github.com/cheese-grinder/stencil-sass-alias/blob/main/CONTRIBUTING.md#creating-an-issue).
required: true
- label: I agree to follow the [Code of Conduct](https://github.com/cheese-grinder/stencil-sass-alias/blob/main/CODE_OF_CONDUCT.md).
required: true
- label: I have searched for [existing issues](https://github.com/cheese-grinder/stencil-sass-alias/issues) that already report this problem, without success.
required: true

- type: dropdown
id: affected-versions
attributes:
label: Version
description: Which version(s) of stencil-sass-alias does this issue impact?
options:
- v0.x
multiple: true
validations:
required: true

- type: textarea
id: current-behavior
attributes:
label: Current Behavior
description: A clear description of what the bug is and how it manifests.
validations:
required: true

- type: textarea
id: expected-behavior
attributes:
label: Expected Behavior
description: A clear description of what you expected to happen.
validations:
required: true

- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to Reproduce
description: Please explain the steps required to duplicate this issue.
placeholder: |
1.
2.
3.
validations:
required: true

- type: input
id: reproduction-url
attributes:
label: Code Reproduction URL
description: Please reproduce this issue in a blank Poppy UI starter application and provide a link to the repo.
placeholder: https://github.com/...

- type: textarea
id: additional-information
attributes:
label: Additional Information
description: List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc.
57 changes: 57 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 💡 Feature Request
description: Suggest an idea for stencil-sass-alias
title: 'feat: '
body:

- type: checkboxes
id: prerequisites
attributes:
label: Prerequisites
description: Please ensure you have completed all of the following.
options:
- label: I have read the [Contributing Guidelines](https://github.com/cheese-grinder/stencil-sass-alias/blob/main/CONTRIBUTING.md#creating-an-issue).
required: true
- label: I agree to follow the [Code of Conduct](https://github.com/cheese-grinder/stencil-sass-alias/blob/main/CODE_OF_CONDUCT.md).
required: true
- label: I have searched for [existing issues](https://github.com/cheese-grinder/stencil-sass-alias/issues) that already include this feature request, without success.
required: true

- type: textarea
id: description
attributes:
label: Describe the Feature Request
description: A clear and concise description of what the feature does.
validations:
required: true

- type: textarea
id: use-case
attributes:
label: Describe the Use Case
description: A clear and concise use case for what problem this feature would solve.
validations:
required: true

- type: textarea
id: proposed-solution
attributes:
label: Describe Preferred Solution
description: A clear and concise description of what you how you want this feature to be added to Poppy UI.

- type: textarea
id: alternatives-considered
attributes:
label: Describe Alternatives
description: A clear and concise description of any alternative solutions or features you have considered.

- type: textarea
id: related-code
attributes:
label: Related Code
description: If you are able to illustrate the feature request with an example, please provide a sample Poppy UI application.

- type: textarea
id: additional-information
attributes:
label: Additional Information
description: List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to implement, Stack Overflow links, forum links, etc.
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Build

on:
workflow_call:
push:
paths-ignore:
- '.github/**'
- '.husky/**'
- 'assets/**'
branches:
- main
- develop
- 'feat/**'
- 'fix/**'
pull_request:
branches:
- main
- develop

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install
run: npm ci

- name: Audit
run: npx audit-ci@latest --config ./audit-ci.json

- name: Prettier
run: npm run format

- name: Lint
run: npm run lint

- name: Build
run: npm run build --if-present
51 changes: 51 additions & 0 deletions .github/workflows/code-smell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow integrates njsscan with GitHub's Code Scanning feature
# nodejsscan is a static security code scanner that finds insecure code patterns in your Node.js applications

name: Code smell

on:
push:
paths-ignore:
- '.github/**'
- '.husky/**'
- 'assets/**'
branches:
- main
- develop
- 'feat/**'
- 'fix/**'
pull_request:
branches:
- main
- develop
schedule:
- cron: '22 21 * * 6'

permissions:
contents: read

jobs:
njsscan:
name: Code scanning
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: nodejsscan scan
id: njsscan
uses: ajinabraham/njsscan-action@7237412fdd36af517e2745077cedbf9d6900d711
with:
args: '. --sarif --output results.sarif || true'
- name: Upload njsscan report
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
39 changes: 39 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
# packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: 'Dependency review'
on:
pull_request:
branches: [ "main" ]

# If using a dependency submission action in this workflow this permission will need to be set to:
#
# permissions:
# contents: write
#
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
permissions:
contents: read
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
pull-requests: write

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout repository'
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
with:
comment-summary-in-pr: always
# fail-on-severity: moderate
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
# retry-on-snapshot-warnings: true
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Publish

on:
workflow_dispatch:
inputs:
version:
description: Release type
required: false
type: choice
default: patch
options:
- patch
- minor
- major
release:
types: [created]

jobs:
build:
uses: ./.github/workflows/build.yml

publish:
needs: build
runs-on: ubuntu-latest
name: Update version in package.json
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write
steps:
- uses: actions/checkout@v4

- name: Bump version
id: version
uses: KageKirin/[email protected]
with:
major: ${{ github.event.inputs.version == 'major' }}
minor: ${{ github.event.inputs.version == 'minor' }}
patch: ${{ github.event.inputs.version == 'patch' }}

- name: Commit & tag version
uses: EndBug/add-and-commit@v9
with:
author_name: cheese_grinder_ci
author_email: [email protected]
committer_name: cheese_grinder_ci
committer_email: [email protected]
message: "ci(version): bump to ${{ steps.version.outputs.version }}"
tag: "v${{ steps.version.outputs.version }}"

- name: npm
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit
11 changes: 11 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { UserConfig, RuleConfigSeverity } from '@commitlint/types';

export default {
extends: ['@commitlint/config-conventional'],
rules: {
"body-empty": [RuleConfigSeverity.Disabled, 'never'],
"body-leading-blank": [RuleConfigSeverity.Disabled, 'never'],
"footer-empty": [RuleConfigSeverity.Disabled, 'never'],
"footer-leading-blank": [RuleConfigSeverity.Disabled, 'never'],
}
} satisfies UserConfig;
Loading

0 comments on commit d5c163e

Please sign in to comment.