diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..eecf8f28 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,20 @@ +--- +name: Bug report +description: Something isn't working +title: "[Bug] " +labels: bug, contributor-friendly +--- + +**Describe the bug** +A clear description of what’s wrong. + +**To reproduce** +Steps to reproduce: +1. … +2. … + +**Expected behavior** +What you expected. + +**Environment** +- Browser / OS (if relevant) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..64eb98dc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +blank_issues_enabled: true +contact_links: [] diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..d66269c7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,15 @@ +--- +name: Feature request +description: Suggest an improvement or new feature +title: "[Enhancement] " +labels: enhancement, contributor-friendly +--- + +**Describe the feature** +What you’d like to see. + +**Why it’s useful** +Brief use case or problem it solves. + +**Optional: possible implementation** +Rough idea of how it could work. diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml new file mode 100644 index 00000000..afd054f1 --- /dev/null +++ b/.github/workflows/auto-label-issues.yml @@ -0,0 +1,54 @@ +# Auto-label issues (bug, enhancement, good first issue, maintainer vs contributor) +name: Auto-label issues + +on: + issues: + types: [opened, edited] + +permissions: + issues: write + +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: Label issue + uses: actions/github-script@v7 + with: + script: | + const issue = context.payload.issue; + const title = (issue.title || '').toLowerCase(); + const body = (issue.body || '').toLowerCase(); + const text = title + ' ' + body; + + const labelsToAdd = []; + + if (/\b(bug|fix|broken|error|fixes)\b/.test(text)) { + labelsToAdd.push('bug'); + } + if (/\b(feature|enhancement|improvement)\b/.test(text)) { + labelsToAdd.push('enhancement'); + } + if (/\b(doc|readme|documentation)\b/.test(text)) { + labelsToAdd.push('documentation'); + } + if (/\b(good first issue|first issue|starter)\b/.test(text)) { + labelsToAdd.push('good first issue'); + } + + if (/\[maintainer\]|maintainer only|internal\b/.test(text)) { + labelsToAdd.push('maintainer-only'); + } else { + labelsToAdd.push('contributor-friendly'); + } + + const existing = (issue.labels || []).map(l => l.name); + const toAdd = labelsToAdd.filter(l => !existing.includes(l)); + if (toAdd.length === 0) return; + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: toAdd + }); diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml new file mode 100644 index 00000000..8aae4197 --- /dev/null +++ b/.github/workflows/auto-label-prs.yml @@ -0,0 +1,46 @@ +# Auto-label PRs when opened/edited (bug, enhancement, documentation, etc.) +name: Auto-label PRs + +on: + pull_request: + types: [opened, edited] + +permissions: + pull-requests: write + contents: read + +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: Label PR + uses: actions/github-script@v7 + with: + script: | + const pr = context.payload.pull_request; + const title = (pr.title || '').toLowerCase(); + const body = (pr.body || '').toLowerCase(); + const text = title + ' ' + body; + + const labelsToAdd = []; + + if (/\b(bug|fix|fixes|broken)\b/.test(text)) { + labelsToAdd.push('bug'); + } + if (/\b(feature|enhancement|improvement)\b/.test(text)) { + labelsToAdd.push('enhancement'); + } + if (/\b(doc|readme|documentation)\b/.test(text)) { + labelsToAdd.push('documentation'); + } + + const existing = (pr.labels || []).map(l => l.name); + const toAdd = labelsToAdd.filter(l => !existing.includes(l)); + if (toAdd.length === 0) return; + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + labels: toAdd + }); diff --git a/.github/workflows/welcome-new-contributors.yml b/.github/workflows/welcome-new-contributors.yml new file mode 100644 index 00000000..f4bd2dc6 --- /dev/null +++ b/.github/workflows/welcome-new-contributors.yml @@ -0,0 +1,60 @@ +# Welcome new contributors (per project doc: "Pull requests are welcome. Found a bug? Open an issue.") +name: Welcome new contributors + +on: + issues: + types: [opened] + pull_request: + types: [opened] + +permissions: + issues: write + pull-requests: write + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - name: Welcome on first issue + if: github.event_name == 'issues' + uses: actions/github-script@v7 + with: + script: | + const author = context.payload.issue.user.login; + const repo = context.repo; + const { data: issueData } = await github.rest.search.issuesAndPullRequests({ + q: `repo:${repo.owner}/${repo.repo} is:issue author:${author}` + }); + const isFirstIssue = issueData.total_count <= 1; + const welcome = isFirstIssue + ? 'Welcome to the project! ' + : ''; + const body = welcome + 'Thanks for opening this issue. Pull requests are welcome—see [CONTRIBUTING](https://github.com/' + repo.owner + '/' + repo.repo + '/blob/main/CONTRIBUTING.md) for guidelines. Found a bug? Describe steps to reproduce and we\'ll label it.'; + await github.rest.issues.createComment({ + owner: repo.owner, + repo: repo.repo, + issue_number: context.payload.issue.number, + body + }); + + - name: Welcome on first PR + if: github.event_name == 'pull_request' + uses: actions/github-script@v7 + with: + script: | + const author = context.payload.pull_request.user.login; + const repo = context.repo; + const { data: prData } = await github.rest.search.issuesAndPullRequests({ + q: `repo:${repo.owner}/${repo.repo} is:pr author:${author}` + }); + const isFirstPR = prData.total_count <= 1; + const welcome = isFirstPR + ? 'Welcome to the project! ' + : ''; + const body = welcome + 'Thanks for your pull request. See [CONTRIBUTING](https://github.com/' + repo.owner + '/' + repo.repo + '/blob/main/CONTRIBUTING.md) for guidelines. We\'ll review as soon as we can.'; + await github.rest.issues.createComment({ + owner: repo.owner, + repo: repo.repo, + issue_number: context.payload.pull_request.number, + body + }); diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..c7ca8f27 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ +# Contributing to Eye Lab + +Thanks for your interest in contributing. Pull requests are welcome, and if you find a bug, please open an issue. + +## Getting started + +1. **Fork and clone** this repo. +2. **Install dependencies** (see [README](README.md#-local-setup)): + ```bash + npm install + npm run serve + ``` +3. **Open an issue** before larger changes so we can align on approach. +4. **Branch** from `main` and keep changes focused (e.g. one fix or feature per PR). + +## What to work on + +- **Good first issue** – Labeled issues that are suited for new contributors. +- **Bug** – Something broken; please describe steps to reproduce. +- **Enhancement** – New feature or improvement; describe the use case. + +Maintainer-only or internal tasks are labeled separately; everything else is open for contributors. + +## Pull requests + +- Target the `main` branch. +- Keep the PR small and the description clear. +- Ensure `npm run build` passes locally. + +We’ll review as soon as we can. Thanks for contributing. + +--- + +**Note for maintainers:** The repo uses auto-labeling. Ensure these labels exist: `bug`, `enhancement`, `documentation`, `good first issue`, `maintainer-only`, `contributor-friendly`.