From 8e615e9683f8a2921e2c7db7fe0cfdb82c9488a9 Mon Sep 17 00:00:00 2001 From: sarthakjdev Date: Thu, 16 May 2024 21:03:18 +0530 Subject: [PATCH] feat: add .github dir Signed-off-by: sarthakjdev --- .github/COMMIT_CONVENTION.md | 98 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 40 +++++++++ .github/ISSUE_TEMPLATE/config.yaml | 5 ++ .github/ISSUE_TEMPLATE/custom.md | 7 ++ .github/ISSUE_TEMPLATE/feature_request.md | 19 +++++ .github/PULL_REQUEST_TEMPLATE.md | 3 + .github/workflows/auto-comment.yaml | 18 +++++ .github/workflows/formatTag/action.yml | 16 ++++ .github/workflows/formatTag/formatTag.js | 22 +++++ .github/workflows/formatTag/index.js | 11 +++ .github/workflows/validate-pr-title.yml | 30 +++++++ 11 files changed, 269 insertions(+) create mode 100644 .github/COMMIT_CONVENTION.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yaml create mode 100644 .github/ISSUE_TEMPLATE/custom.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/auto-comment.yaml create mode 100644 .github/workflows/formatTag/action.yml create mode 100644 .github/workflows/formatTag/formatTag.js create mode 100644 .github/workflows/formatTag/index.js create mode 100644 .github/workflows/validate-pr-title.yml diff --git a/.github/COMMIT_CONVENTION.md b/.github/COMMIT_CONVENTION.md new file mode 100644 index 0000000..0b6654b --- /dev/null +++ b/.github/COMMIT_CONVENTION.md @@ -0,0 +1,98 @@ +# ๐Ÿ“˜ Commit and Branch Conventions + +At `wapi.js`, we follow a strict set of conventions for commit messages and branch names to ensure that our repository stays organized, and our commit history remains crystal clear. Here's a guide on our conventions: + +--- + +## ๐Ÿš€ Conventional Commits + +Conventional commits ensure our commit messages are clear and useful. + +๐Ÿ“‹ **Benefits**: + +- ๐Ÿ“œ Automatic changelog generation +- ๐Ÿ”ข Simplified versioning +- ๐Ÿง Improved readability of commit messages + +### ๐Ÿ“„ Commit Message Format + +Each commit message should follow this format: + +``` +(): + + + + +``` + +- **``**: Describes the purpose of the commit: + - ๐Ÿ†• `feat`: Introduces a new feature + - ๐Ÿž `fix`: Addresses a bug + - ๐Ÿ“š `docs`: Updates documentation + - ๐ŸŽจ `style`: Code that relates to styling, not affecting logic + - ๐Ÿ”ง `refactor`: Refactoring existing code + - ๐Ÿš€ `perf`: Improving performance + - ๐Ÿงช `test`: All about tests + - ๐Ÿงฝ `chore`: Maintenance tasks +- **``**: (Optional) Specifies which part of the codebase is affected. + +- **``**: A concise summary of the changes made. + +### ๐Ÿ“ Examples: + +1. Introducing a new feature: + +``` +feat(auth): implement social login +``` + +2. Addressing a bug: + +``` +fix(button): resolve alignment issue +``` + +--- + +## ๐ŸŒฒ Conventional Branching + +A standardized naming system for branches helps everyone quickly understand a branch's purpose. + +### ๐Ÿ“„ Branch Naming Format + +Branch names should adhere to: + +``` +/ +``` + +- **``**: Purpose of the branch, common ones being: + + - ๐Ÿ†• `feature`: Developing a new feature. + - ๐Ÿž `fix`: Addressing a bug. + - ๐Ÿงฝ `chore`: Regular maintenance tasks. + - ๐Ÿ”ฅ `hotfix`: Immediate fixes, often tied to production issues. + - ๐Ÿ“š `docs`: Documentation enhancements. + +- **``**: A brief, kebab-cased (words separated by hyphens) description of the branch's objective. + +### ๐Ÿ“ Examples: + +1. Developing a new user dashboard: + +``` +feature/user-dashboard +``` + +2. Resolving a login issue: + +``` +fix/login-issue +``` + +--- + +๐Ÿ™Œ Thanks for contributing to `wapi.js`! By adhering to these conventions, we're making our repository a better place. If you're new, welcome aboard, and if you've been here, thanks for sticking around! + +--- diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..9b77ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,40 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "" +labels: "" +assignees: "" +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] + +**Smartphone (please complete the following information):** + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 0000000..46be629 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Discord server + url: https://discord.gg/PytnZqWpeQ + about: Please visit our Discord server for questions and support requests. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 0000000..babf9b2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,7 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: "" +labels: "" +assignees: "" +--- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..2bc5d5f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "" +labels: "" +assignees: "" +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..2dcc071 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,3 @@ +**Please describe the changes this PR makes and why it should be merged:** + +**Status and versioning classification:** diff --git a/.github/workflows/auto-comment.yaml b/.github/workflows/auto-comment.yaml new file mode 100644 index 0000000..17b974a --- /dev/null +++ b/.github/workflows/auto-comment.yaml @@ -0,0 +1,18 @@ +name: Auto Comment on New Issue Label +# This workflow is triggered when a label is added to an issue. +on: + issues: + types: [labeled] + +jobs: + processLabelAction: + name: Process Label Action + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Process Label Action + uses: hramos/respond-to-issue-based-on-label@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: ".github/label-actions.yml" diff --git a/.github/workflows/formatTag/action.yml b/.github/workflows/formatTag/action.yml new file mode 100644 index 0000000..baef702 --- /dev/null +++ b/.github/workflows/formatTag/action.yml @@ -0,0 +1,16 @@ +name: 'Format Tag' +description: 'Formats a git tag to remove potentially prefixes' +inputs: + tag: + description: 'The input tag' + required: true +outputs: + subpackage: + description: 'Whether this tag is a subpackage tag' + package: + description: 'The package string that was extracted from this tag' + semver: + description: 'The semver string that was extracted from this tag' +runs: + using: node20 + main: ./index.js diff --git a/.github/workflows/formatTag/formatTag.js b/.github/workflows/formatTag/formatTag.js new file mode 100644 index 0000000..0f847d8 --- /dev/null +++ b/.github/workflows/formatTag/formatTag.js @@ -0,0 +1,22 @@ +export function formatTag(tag) { + const parsed = /(?:^@.*\/(?.*)@v?)?(?\d+.\d+.\d+)-?.*/.exec( + tag + ); + const parsedPackage = /(?.*)@v?-?.*/.exec(tag); + + if (parsed?.groups) { + const isSubPackage = typeof parsed.groups.package === "string"; + const pkg = isSubPackage + ? parsed.groups.package + : parsedPackage?.groups?.package ?? "wapi.js"; + const semver = parsed.groups.semver; + + return { + isSubpackage: isSubPackage, + package: pkg, + semver, + }; + } + + return null; +} diff --git a/.github/workflows/formatTag/index.js b/.github/workflows/formatTag/index.js new file mode 100644 index 0000000..5ddc8d9 --- /dev/null +++ b/.github/workflows/formatTag/index.js @@ -0,0 +1,11 @@ +import { getInput, setOutput } from "@actions/core"; +import { formatTag } from "./formatTag.js"; + +const tag = getInput("tag", { required: true }); +const parsed = formatTag(tag); + +if (parsed) { + setOutput("subpackage", parsed.isSubpackage); + setOutput("package", parsed.package); + setOutput("semver", parsed.semver); +} diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml new file mode 100644 index 0000000..5b99bed --- /dev/null +++ b/.github/workflows/validate-pr-title.yml @@ -0,0 +1,30 @@ +name: Check PR title + +on: + pull_request: + types: + - opened + - reopened + - edited + - synchronize + - review_requested + - auto_merge_enabled + +concurrency: + group: check-pr-title-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + validate-pr-title: + name: Validate PR title + runs-on: ubuntu-latest + permissions: + statuses: write + timeout-minutes: 10 + steps: + - uses: aslafy-z/conventional-pr-title-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + success-state: "PR Title follows the Conventional Commits spec" + failure-state: "PR Title does not follow the Conventional Commits spec"