mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 11:44:31 +00:00
chore: update pull request template and add PR title validation workflow
This commit is contained in:
38
.github/pull_request_template.md
vendored
38
.github/pull_request_template.md
vendored
@@ -1,23 +1,27 @@
|
||||
# Description 📣
|
||||
## Context
|
||||
|
||||
<!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. Here's how we expect a pull request to be : https://infisical.com/docs/contributing/getting-started/pull-requests -->
|
||||
<!-- What problem does this solve? What was the behavior before, and what is it now? Add all relevant context. Link related issues/tickets. -->
|
||||
|
||||
## Type ✨
|
||||
## Screenshots
|
||||
|
||||
- [ ] Bug fix
|
||||
- [ ] New feature
|
||||
<!-- If UI/UX changes, add screenshots or videos. Delete if not applicable. -->
|
||||
|
||||
## How to test
|
||||
|
||||
<!-- Steps to verify the change. -->
|
||||
|
||||
## Type
|
||||
|
||||
- [ ] Fix
|
||||
- [ ] Feature
|
||||
- [ ] Improvement
|
||||
- [ ] Breaking change
|
||||
- [ ] Documentation
|
||||
- [ ] Breaking
|
||||
- [ ] Docs
|
||||
- [ ] Chore
|
||||
|
||||
# Tests 🛠️
|
||||
## Checklist
|
||||
|
||||
<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. You may want to add screenshots when relevant and possible -->
|
||||
|
||||
```sh
|
||||
# Here's some code block to paste some code snippets
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
- [ ] I have read the [contributing guide](https://infisical.com/docs/contributing/getting-started/overview), agreed and acknowledged the [code of conduct](https://infisical.com/docs/contributing/getting-started/code-of-conduct). 📝
|
||||
- [ ] Title follows format: `Type: Short description` (e.g., `Fix: Prevent crash on sync`)
|
||||
- [ ] Tested locally
|
||||
- [ ] Updated docs (if needed)
|
||||
- [ ] Read the [contributing guide](https://infisical.com/docs/contributing/getting-started/overview)
|
||||
51
.github/workflows/validate-pr-title.yml
vendored
Normal file
51
.github/workflows/validate-pr-title.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Validate PR Title
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
validate-pr-title:
|
||||
name: Validate PR Title Format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check PR Title Format
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
with:
|
||||
script: |
|
||||
const title = context.payload.pull_request.title;
|
||||
|
||||
// Valid PR types based on pull_request_template.md
|
||||
const validTypes = ['Fix', 'Feature', 'Improvement', 'Breaking', 'Docs', 'Chore'];
|
||||
|
||||
// Regex pattern: Type: Short description
|
||||
// Type must be one of the valid types, followed by colon, space, and description
|
||||
const pattern = new RegExp(`^(${validTypes.join('|')}): .+$`);
|
||||
|
||||
if (!pattern.test(title)) {
|
||||
const errorMessage = `
|
||||
❌ **Invalid PR Title Format**
|
||||
|
||||
Your PR title: \`${title}\`
|
||||
|
||||
**Expected format:** \`Type: Short description\`
|
||||
|
||||
**Valid types:**
|
||||
- \`Fix\` - Bug fixes
|
||||
- \`Feature\` - New features
|
||||
- \`Improvement\` - Enhancements to existing features
|
||||
- \`Breaking\` - Breaking changes
|
||||
- \`Docs\` - Documentation updates
|
||||
- \`Chore\` - Maintenance tasks
|
||||
|
||||
**Examples:**
|
||||
- \`Fix: Prevent crash on sync\`
|
||||
- \`Feature: Add SSO login support\`
|
||||
- \`Docs: Update API reference\`
|
||||
`;
|
||||
|
||||
core.setFailed(errorMessage);
|
||||
} else {
|
||||
console.log(`✅ PR title is valid: "${title}"`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user