diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..bd1278f --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1,29 @@ +{ + "extends": ["@commitlint/config-conventional"], + "rules": { + "type-enum": [ + 2, + "always", + [ + "feat", + "fix", + "docs", + "style", + "refactor", + "perf", + "test", + "chore", + "ci", + "build", + "revert" + ] + ], + "type-case": [2, "always", "lower-case"], + "type-empty": [2, "never"], + "subject-empty": [2, "never"], + "subject-full-stop": [2, "never", "."], + "header-max-length": [2, "always", 72], + "body-leading-blank": [1, "always"], + "footer-leading-blank": [1, "always"] + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e191d25..55c0c17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,23 +34,23 @@ jobs: # Generate multiple formats for different actions to demonstrate new functionality echo "Generating documentation for example-action..." - go run . gen testdata/example-action/ --output $PWD/docs/example-action.md - go run . gen testdata/example-action/ -f html --output $PWD/docs/example-action.html - go run . gen testdata/example-action/ -f json --output $PWD/docs/example-action.json + go run . gen testdata/example-action/ --output "$PWD/docs/example-action.md" + go run . gen testdata/example-action/ -f html --output "$PWD/docs/example-action.html" + go run . gen testdata/example-action/ -f json --output "$PWD/docs/example-action.json" echo "Generating documentation for composite-action..." - go run . gen testdata/composite-action/ --output $PWD/docs/composite-action.md - go run . gen testdata/composite-action/ -f html --output $PWD/docs/composite-action.html + go run . gen testdata/composite-action/ --output "$PWD/docs/composite-action.md" + go run . gen testdata/composite-action/ -f html --output "$PWD/docs/composite-action.html" # Test single file targeting echo "Generating from specific action.yml files..." - go run . gen testdata/example-action/action.yml --output $PWD/docs/direct-example.md - go run . gen testdata/composite-action/action.yml --output $PWD/docs/direct-composite.md + go run . gen testdata/example-action/action.yml --output "$PWD/docs/direct-example.md" + go run . gen testdata/composite-action/action.yml --output "$PWD/docs/direct-composite.md" # Test recursive generation with different themes echo "Testing recursive generation with themes..." - go run . gen testdata/ --recursive --theme minimal -f html --output $PWD/docs/all-actions-minimal.html - go run . gen testdata/ --recursive --theme professional -f json --output $PWD/docs/all-actions-professional.json + go run . gen testdata/ --recursive --theme minimal -f html --output "$PWD/docs/all-actions-minimal.html" + go run . gen testdata/ --recursive --theme professional -f json --output "$PWD/docs/all-actions-professional.json" # Verify files were generated echo "Verifying generated documentation files..." diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..3158be8 --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,40 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +name: Commit Messages + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - main + +permissions: + contents: read + +jobs: + commitlint: + name: Validate Commit Messages + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 + with: + node-version: '22' + + - name: Install commitlint + run: | + npm install --save-dev @commitlint/cli@19.6.1 @commitlint/config-conventional@19.6.0 + + - name: Validate current commit (for single commits) + if: github.event_name == 'push' + run: npx commitlint --from HEAD~1 --to HEAD --verbose + + - name: Validate PR commits + if: github.event_name == 'pull_request' + run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0da7398..308906b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: - name: Install cosign uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0 with: - cosign-release: 'v2.2.2' + cosign-release: 'v2.4.0' - name: Install syft uses: anchore/sbom-action/download-syft@f8bdd1d8ac5e901a77a92f111440fdb1b593736b # v0.20.6 diff --git a/.gitignore b/.gitignore index 0c1bdba..dab3f25 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ go.sum /gh-action-readme *.out +actionlint # Created readme files testdata/**/*.md diff --git a/.goreleaser.yaml b/.goreleaser.yaml index d524813..ae31ffa 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -251,4 +251,4 @@ sboms: # Announce announce: - skip: '{{gt .Patch 0}}' \ No newline at end of file + skip: '{{gt .Patch 0}}' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53213d0..9ba8083 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -74,3 +74,11 @@ repos: hooks: - id: actionlint args: ["-shellcheck="] + + # Commit message linting + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v9.24.0 + hooks: + - id: commitlint + stages: [commit-msg] + additional_dependencies: ["@commitlint/config-conventional"] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index efb9715..938bcda 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,7 +135,7 @@ Improve documentation and examples: - [ ] Tests added for new features (`make test` passes) - [ ] Documentation updated for user-facing changes - [ ] No security vulnerabilities (`make security` passes) -- [ ] Commit messages follow conventional format +- [ ] Commit messages follow [conventional commit format](docs/COMMIT_MESSAGES.md) ### PR Requirements @@ -204,7 +204,7 @@ if err != nil { ### Commit Message Format -Follow [Conventional Commits](https://conventionalcommits.org/): +Follow [Conventional Commits](https://conventionalcommits.org/). See [docs/COMMIT_MESSAGES.md](docs/COMMIT_MESSAGES.md) for detailed guidelines. ```bash # Feature additions diff --git a/docs/COMMIT_MESSAGES.md b/docs/COMMIT_MESSAGES.md new file mode 100644 index 0000000..5b9f00f --- /dev/null +++ b/docs/COMMIT_MESSAGES.md @@ -0,0 +1,76 @@ +# Semantic Commit Messages + +This project follows [Conventional Commits](https://www.conventionalcommits.org/) specification for commit messages. + +## Format + +``` +(): + + + +