-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add lefthook, PR workflows, and CI standardization #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited, synchronize, reopened] | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| title: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Validate PR title follows Conventional Commits | ||
| env: | ||
| TITLE: ${{ github.event.pull_request.title }} | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| if echo "$TITLE" | grep -qE "^(feat|fix|docs|style|refactor|test|chore|build|ci|perf|revert)(\(.+\))?(!)?: .+"; then | ||
| echo "PR title is valid: $TITLE" | ||
| exit 0 | ||
| fi | ||
|
|
||
| BODY=$(cat <<'COMMENT' | ||
| ### ⚠️ Invalid PR Title | ||
|
|
||
| PR title must follow the **Conventional Commits** format since we use squash merge: | ||
|
|
||
| ``` | ||
| <type>[optional scope][!]: <description> | ||
| ``` | ||
|
|
||
| **Allowed types:** `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `build`, `ci`, `perf`, `revert` | ||
|
|
||
| **Examples:** | ||
| - `feat: add new feature` | ||
| - `fix(api): resolve null pointer` | ||
| - `feat!: breaking change` | ||
| - `chore(deps): update dependencies` | ||
| COMMENT | ||
| ) | ||
|
|
||
| # Post comment on PR | ||
| gh api "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \ | ||
| -X POST -f body="$BODY" | ||
|
|
||
| echo "::error::PR title must follow Conventional Commits format" | ||
| exit 1 | ||
|
|
||
| review: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: AxeForging/reviewforge@main | ||
| with: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| AI_PROVIDER: gemini | ||
| AI_MODEL: gemini-2.5-flash | ||
| AI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | ||
| SHOW_TOKEN_USAGE: true | ||
| INCREMENTAL: false | ||
| REVIEW_RULES: concise | ||
|
|
||
| validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: AxeForging/structlint@main | ||
| with: | ||
| config: .structlint.yaml | ||
| comment-on-pr: "true" | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| name: ReleaseForge | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| command: | ||
| description: "Command: bump, generate" | ||
| type: string | ||
| default: "bump" | ||
| tag: | ||
| description: "Base semver tag" | ||
| type: string | ||
| default: "" | ||
| branch: | ||
| description: "Target branch" | ||
| type: string | ||
| default: "HEAD" | ||
| provider: | ||
| description: "LLM provider for generate" | ||
| type: string | ||
| default: "gemini" | ||
| model: | ||
| description: "LLM model for generate" | ||
| type: string | ||
| default: "gemini-2.0-flash" | ||
| template-name: | ||
| description: "Built-in template name" | ||
| type: string | ||
| default: "" | ||
| max-commits: | ||
| description: "Max commits to analyze" | ||
| type: string | ||
| default: "200" | ||
| secrets: | ||
| api_key: | ||
| description: "LLM API key (for generate command)" | ||
| required: false | ||
| outputs: | ||
| next-version: | ||
| description: "Next semver version" | ||
| value: ${{ jobs.releaseforge.outputs.next-version }} | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| releaseforge: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| next-version: ${{ steps.rf.outputs.next-version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - id: rf | ||
| uses: AxeForging/releaseforge@main | ||
| with: | ||
| command: ${{ inputs.command }} | ||
| tag: ${{ inputs.tag }} | ||
| branch: ${{ inputs.branch }} | ||
| provider: ${{ inputs.provider }} | ||
| model: ${{ inputs.model }} | ||
| api-key: ${{ secrets.api_key }} | ||
| template-name: ${{ inputs.template-name }} | ||
| max-commits: ${{ inputs.max-commits }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,18 +2,20 @@ name: Test | |
|
|
||
| on: | ||
| push: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [WARNING] The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed — push now triggers on all branches, pull_request on main only. |
||
| branches: ["**"] | ||
| pull_request: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CRITICAL] The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed — push now triggers on all branches, pull_request on main only. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [WARNING] The change from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed — push now triggers on all branches, pull_request on main only. |
||
| branches: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [WARNING] The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed — push now triggers on all branches, pull_request on main only. |
||
| - main | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.24' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # structlint configuration | ||
| # Validates project directory structure and file naming | ||
|
|
||
| dir_structure: | ||
| allowedPaths: | ||
| - "." | ||
| - "actions/**" | ||
| - "services/**" | ||
| - "helpers/**" | ||
| - "domain/**" | ||
| - "integration/**" | ||
| - "doc/**" | ||
| - "dist/**" | ||
| - ".claude/**" | ||
| - ".github/**" | ||
| disallowedPaths: | ||
| - "vendor/**" | ||
| - "node_modules/**" | ||
| - "tmp/**" | ||
| - "temp/**" | ||
| - ".git/**" | ||
| - "*.log" | ||
| requiredPaths: | ||
| - "actions" | ||
| - "services" | ||
| - "domain" | ||
|
|
||
| file_naming_pattern: | ||
| allowed: | ||
| - "*.go" | ||
| - "*.mod" | ||
| - "*.sum" | ||
| - "*.yaml" | ||
| - "*.yml" | ||
| - "*.json" | ||
| - "*.toml" | ||
| - "*.md" | ||
| - "*.txt" | ||
| - "*.png" | ||
| - "*.jpg" | ||
| - "*.svg" | ||
| - "README*" | ||
| - "LICENSE*" | ||
| - "CHANGELOG*" | ||
| - "Makefile" | ||
| - "Dockerfile*" | ||
| - "*.sh" | ||
| - ".gitignore" | ||
| - ".editorconfig" | ||
| - ".golangci.yml" | ||
| - ".goreleaser.yml" | ||
| - ".github/**" | ||
| - "go.work" | ||
| - "go.work.sum" | ||
| disallowed: | ||
| - "*.env*" | ||
| - ".env*" | ||
| - "*.key" | ||
| - "*.pem" | ||
| - "*.log" | ||
| - "*.tmp" | ||
| - "*.temp" | ||
| - "*~" | ||
| - "*.swp" | ||
| - "*.bak" | ||
| - ".DS_Store" | ||
| - "Thumbs.db" | ||
| required: | ||
| - "go.mod" | ||
| - "README.md" | ||
| - ".gitignore" | ||
| - "*.go" | ||
|
|
||
| ignore: | ||
| - ".git" | ||
| - "vendor" | ||
| - "node_modules" | ||
| - "bin" | ||
| - "dist" | ||
| - ".idea" | ||
| - ".vscode" | ||
| - ".DS_Store" | ||
| - "*.log" | ||
| - "*.tmp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CRITICAL] The
on: push:trigger has been removed, andpull_requestis now restricted tobranches: - main. This means tests will no longer run on pushes to any branch or on pull requests targeting branches other thanmain. This is a significant reduction in CI coverage and could lead to issues being introduced without immediate detection. Please clarify if this change is intentional. If not, the originalbranches: ["**"]forpushand an unrestrictedpull_requesttrigger should be restored, or a more comprehensive testing strategy for all branches should be implemented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed — push now triggers on all branches, pull_request on main only.