feat: initial
This commit is contained in:
commit
6eed0afd4d
8 changed files with 339 additions and 0 deletions
37
.forgejo/workflows/test.yaml
Normal file
37
.forgejo/workflows/test.yaml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
name: Test action
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
test-valid:
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Test valid commit
|
||||
uses: ./
|
||||
with:
|
||||
value: "feat(core): add new validation"
|
||||
|
||||
test-invalid:
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Test invalid commit
|
||||
id: test-fail
|
||||
continue-on-error: true
|
||||
uses: ./
|
||||
with:
|
||||
value: "Added new validation"
|
||||
- name: Check if test failed
|
||||
if: steps.test-fail.outcome == 'success'
|
||||
run: |
|
||||
echo "The test should have failed but it succeeded."
|
||||
exit 1
|
||||
201
.gitignore
vendored
Normal file
201
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
.output
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp directory
|
||||
.temp
|
||||
|
||||
# Sveltekit cache directory
|
||||
.svelte-kit/
|
||||
|
||||
# vitepress build output
|
||||
**/.vitepress/dist
|
||||
|
||||
# vitepress cache directory
|
||||
**/.vitepress/cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# Firebase cache directory
|
||||
.firebase/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# pnpm
|
||||
.pnpm-store
|
||||
|
||||
# yarn v3
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# Vite files
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
.vite/
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.localized
|
||||
__MACOSX/
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon[
]
|
||||
|
||||
# Resource forks
|
||||
._*
|
||||
|
||||
# Files and directories that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
.com.apple.timemachine.supported
|
||||
.PKInstallSandboxManager
|
||||
.PKInstallSandboxManager-SystemSoftware
|
||||
.hotfiles.btree
|
||||
.vol
|
||||
.file
|
||||
.disk_label*
|
||||
lost+found
|
||||
.HFS+ Private Directory Data[
]
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Mac OS 6 to 9
|
||||
Desktop DB
|
||||
Desktop DF
|
||||
TheFindByContentFolder
|
||||
TheVolumeSettingsFolder
|
||||
.FBCIndex
|
||||
.FBCSemaphoreFile
|
||||
.FBCLockFolder
|
||||
|
||||
# Quota system
|
||||
.quota.group
|
||||
.quota.user
|
||||
.quota.ops.group
|
||||
.quota.ops.user
|
||||
|
||||
# TimeMachine
|
||||
Backups.backupdb
|
||||
.MobileBackups
|
||||
.MobileBackups.trash
|
||||
MobileBackups.trash
|
||||
tmbootpicker.efi
|
||||
3
.prettierrc
Normal file
3
.prettierrc
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"printWidth": 120
|
||||
}
|
||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.tabSize": 2
|
||||
}
|
||||
32
README.md
Normal file
32
README.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Check Conventional Commit Action
|
||||
|
||||
This Forgejo Action validates whether a given string complies with the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/).
|
||||
|
||||
## Usage
|
||||
|
||||
Include this action in your workflow and pass the value to be tested (e.g., a pull request title or a commit message) via the `value` input.
|
||||
|
||||
### Example Workflow
|
||||
|
||||
```yaml
|
||||
name: PR Validation
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
check-pr-title:
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- name: Validate PR Title
|
||||
uses: https://stackit-solutions.git.onstackit.cloud/actions/check-conventional-commit@v1
|
||||
with:
|
||||
value: ${{ github.event.pull_request.title }}
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
- `value` (Required): The string (e.g., commit message) to be validated.
|
||||
28
action.yml
Normal file
28
action.yml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
name: "Check conventional commit message"
|
||||
description: "Checks if a value follows the conventional commit message specification."
|
||||
inputs:
|
||||
value:
|
||||
description: "The value to test."
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Check conventional commit message
|
||||
shell: bash
|
||||
env:
|
||||
INPUT_VALUE: ${{ inputs.value }}
|
||||
run: |
|
||||
set -eo pipefail
|
||||
|
||||
CONVENTIONAL_COMMIT_REGEX='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([[:alnum:]._-]+\))?(!)?: .+'
|
||||
|
||||
printf 'Checking "%s"...\n' "$INPUT_VALUE"
|
||||
|
||||
if ! printf '%s\n' "$INPUT_VALUE" | grep -qE "$CONVENTIONAL_COMMIT_REGEX"; then
|
||||
echo "::error title=Invalid Commit Message::Input '$INPUT_VALUE' is not a valid conventional commit message."
|
||||
echo "Please refer to the specification: https://www.conventionalcommits.org/en/v1.0.0/"
|
||||
exit 1
|
||||
else
|
||||
echo "::notice::Input is valid :)"
|
||||
fi
|
||||
28
package-lock.json
generated
Normal file
28
package-lock.json
generated
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "check-conventional-commit",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"prettier": "^3.8.3"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.8.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
|
||||
"integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
5
package.json
Normal file
5
package.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"prettier": "^3.8.3"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue