fix: resolve all linter errors for GitHub Actions #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Feature Branch Merge Helper | |
| on: | |
| pull_request: | |
| branches: [develop] | |
| types: [opened, synchronize, reopened] | |
| # Add permissions for creating comments | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| validate-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Validate PR Title | |
| uses: amannn/action-semantic-pull-request@v5 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| # Types that trigger version bumps | |
| types: | | |
| feat | |
| fix | |
| docs | |
| style | |
| refactor | |
| perf | |
| test | |
| build | |
| ci | |
| chore | |
| revert | |
| # Require a scope for better organization | |
| requireScope: false | |
| # The title should follow conventional commits | |
| validateSingleCommit: false | |
| - name: Auto-format merge commit suggestion | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| try { | |
| const prTitle = context.payload.pull_request.title; | |
| const prNumber = context.payload.pull_request.number; | |
| const prBranch = context.payload.pull_request.head.ref; | |
| // Extract type from branch name or suggest based on changes | |
| let suggestedType = 'feat'; | |
| if (prBranch.includes('fix/') || prBranch.includes('bug/')) { | |
| suggestedType = 'fix'; | |
| } else if (prBranch.includes('feat/') || prBranch.includes('feature/')) { | |
| suggestedType = 'feat'; | |
| } else if (prBranch.includes('docs/')) { | |
| suggestedType = 'docs'; | |
| } | |
| const suggestedCommit = `${suggestedType}: ${prTitle.toLowerCase().replace(/^(feat|fix|docs|style|refactor|perf|test|build|ci|chore):\s*/i, '')}`; | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `🚀 **Merge Commit Suggestion** | |
| For semantic-release to work correctly, use this commit message when squash merging: | |
| \`\`\` | |
| ${suggestedCommit} | |
| \`\`\` | |
| 📝 **Instructions:** | |
| 1. Click "Squash and merge" | |
| 2. Replace the default commit message with the suggestion above | |
| 3. This will trigger appropriate version bump in develop branch | |
| 🎯 **Release impact:** | |
| - \`feat:\` → Minor version (3.6.0 → 3.7.0-beta.1) | |
| - \`fix:\` → Patch version (3.6.0 → 3.6.1-beta.1) | |
| - \`feat!:\` or \`BREAKING CHANGE:\` → Major version (3.6.0 → 4.0.0-beta.1)` | |
| }); | |
| console.log('✅ Successfully created merge commit suggestion comment'); | |
| } catch (error) { | |
| console.log('⚠️ Could not create comment:', error.message); | |
| // Don't fail the workflow if comment creation fails | |
| console.log('This is not critical - the PR validation passed successfully'); | |
| } | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Type check | |
| run: pnpm type-check | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Test | |
| run: pnpm test |