Skip to content

Commit

Permalink
feat: Add Issue Template & workflow & contribution Guideline
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishitbaria committed May 9, 2024
1 parent 3c0b9c6 commit 88dcd50
Show file tree
Hide file tree
Showing 21 changed files with 740 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [Nishitbaria]
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ​🐞 Bug
description: Report an issue to help us improve the project.
title: "[BUG] <write a small description here>"
labels: ["bug", "goal: fix", "priority: medium"]
body:
- type: textarea
attributes:
label: Description
description: A brief description of the issue or bug you are facing, also include what you tried and what didn't work.
validations:
required: false
- type: textarea
attributes:
label: Screenshots
description: Please add screenshots if applicable
validations:
required: false
- type: textarea
attributes:
label: Any additional information?
description: Any additional information or Is there anything we should know about this bug?
validations:
required: false
- type: dropdown
attributes:
label: What browser are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/document.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Documentation 📋"
description: "Use this form to present your suggestions on how to improve our docs"
title: "[DOCS] <write your suggestion here>"
labels: ["documenation", "goal: enhancement"]

body:
- type: textarea
id: docs_description
attributes:
label: "Issue Description"
description: "Please provide a brief summary of the documentation issue you are experiencing or would like to address."
validations:
required: true

- type: textarea
id: screenshots_examples_docs
attributes:
label: "Screenshots or Examples (if applicable)"
description: "Please include relevant screenshots or examples to help illustrate the problem."

- type: textarea
id: proposed_solution_docs
attributes:
label: "Proposed Solution (optional)"
description: "If you have a proposed solution for the documentation issue, please provide it here. This can be helpful for speeding up the resolution process."

- type: checkboxes
id: terms_checklist_docs
attributes:
label: "Checklist"
description: "By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Nishitbaria/OpenGrame/blob/main/CODE_OF_CONDUCT.md)"
options:
- label: "I have checked the existing [issues](https://github.com/Nishitbaria/OpenGrame/issues)"
required: true
- label: "I have read the [Contributing Guidelines](https://github.com/Nishitbaria/OpenGrame/blob/main/CONTRIBUTING.md)"
required: true
- label: "I am willing to work on this issue (optional)"
required: false
- type: markdown
attributes:
value: "Thank you for taking the time to raise this issue! Your input is greatly appreciated."
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Feature Request 💡
description: Have any new idea or new feature for LinksHub? Please suggest!
title: "[Feature] <write a small description here>"
labels: ["enhancement", "goal: addition", "priority: high"]
body:
- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of any alternative solution or features you've considered.
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: Please add screenshots if applicable
validations:
required: false
- type: checkboxes
id: no-duplicate-issues
attributes:
label: "Checklist"
options:
- label: "I have checked the existing issues"
required: true

- label: "I have read the [Contributing Guidelines](https://github.com/Nishitbaria/OpenGrame/blob/main/CONTRIBUTING.md)"
required: true

- label: "I am willing to work on this issue (optional)"
required: false
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Other
description: Use this for any other question or issue. Please do not create blank issues
title: "[OTHER]"
labels: ["status: awaiting triage"]
body:
- type: textarea
id: issuedescription
attributes:
label: What would you like to share or ask?
description: Provide a clear and concise explanation of your issue.
validations:
required: true
- type: checkboxes
id: no-duplicate-issues
attributes:
label: "Checklist"
options:
- label: "I have checked the existing issues"
required: true

- label: "I have read the [Contributing Guidelines](https://github.com/Nishitbaria/OpenGrame/blob/main/CONTRIBUTING.md)"
required: true

- label: "I am willing to work on this issue (optional)"
required: false
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/refactor_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Refactor Code 🔧
description: Use this label for code refactoring tasks.
title: "[Refactor] <write what you want to add>"
labels: ["goal: refactor", "priority: medium"]
body:
- type: input
attributes:
label: File Name
description: "Enter the file that you want to refactor in the codebase."
placeholder: "For example - component/Cards/Card.tsx"
validations:
required: true
- type: textarea
id: refactor_description
attributes:
label: "Reason for Refactoring the Code"
description: "Describe what improvements can be made in the codebase without introducing breaking changes."
validations:
required: true
- type: checkboxes
id: no-duplicate-issues
attributes:
label: "Checklist"
options:
- label: "I have checked the existing [issues](https://github.com/Nishitbaria/OpenGrame/issues)."
required: true

- label: "I have read the [Contributing Guidelines](https://github.com/Nishitbaria/OpenGrame/blob/main/CONTRIBUTING.md)."
required: true

- label: "The changes don't break the code and don't introduce new functionality."
required: true

- label: "I am willing to work on this issue (optional)."
required: false
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
# Update GitHub Actions
- package-ecosystem: "github-actions"
labels:
- 📦 dependencies
directory: "/" # refers to the location of package.json
commit-message:
prefix: "chore(deps)"
schedule:
interval: "daily"
19 changes: 19 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- If your PR fixes an open issue, use `Closes #999` to link your PR with the issue. #999 stands for the issue number you are fixing -->

## Fixes Issue

<!-- Remove this section if not applicable -->

<!-- Example: Closes #31 -->

## Changes proposed

<!-- List all the proposed changes in your PR -->

## Screenshots

<!-- Add all the screenshots which support your changes -->

## Note to reviewers

<!-- Add notes to reviewers if applicable -->
35 changes: 35 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "🚧 Huge Updates"
labels:
- "📈 Major"
- title: "🚀 New Features"
labels:
- "feature"
- title: "🐛 Bug Fixes"
labels:
- "patch"
- "📄 aspect: docs"
- title: "🧰 Maintenance"
labels:
- "chore"
- "dependencies"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&'
version-resolver:
major:
labels:
- "📈 Major"
minor:
labels:
- "feature"
patch:
labels:
- "patch"
- "dependencies"
- "📄 aspect: docs"
default: patch
template: |
$CHANGES
24 changes: 24 additions & 0 deletions .github/workflows/add-labels-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# reference: https://github.com/hoho4190/issue-pr-labeler
name: PR Labeler

on:
pull_request_target:
types:
- opened
- reopened

jobs:
main:
runs-on: ubuntu-latest

permissions:
contents: read # to read configuration yml file
pull-requests: write # to add labels to pull requests

steps:
- name: Run PR Labeler
uses: hoho4190/issue-pr-labeler@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file-name: labeler-config.yml
# disable-bot: true # this will prevent issues, PRs created by bots
16 changes: 16 additions & 0 deletions .github/workflows/author-assign-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Author Assign"

on:
pull_request_target:
types: [opened, reopened]

permissions:
pull-requests: write

jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/[email protected]
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" # GITHUB_TOKEN will be used by default
34 changes: 34 additions & 0 deletions .github/workflows/close_old_issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Close Old Issues
on:
schedule:
- cron: "0 0 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Close Old Issues
run: |
open_issues=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues?state=open" \
| jq -r '.[] | .number')
for issue in $open_issues; do
# Get the last updated timestamp of the issue
last_updated=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/$issue" \
| jq -r '.updated_at')
days_since_update=$(( ( $(date +%s) - $(date -d "$last_updated" +%s) ) / 86400 ))
if [ $days_since_update -gt 30 ]; then
curl -s -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"state":"closed"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/$issue"
fi
done
47 changes: 47 additions & 0 deletions .github/workflows/close_old_prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Close PRs Without Linked Issues

on:
schedule:
- cron: "0 0 * * *"

jobs:
close_prs_without_issue:
runs-on: ubuntu-latest

steps:
- name: Check and Close PRs Without Linked Issues
uses: actions/checkout@v4
with:
fetch-depth: 0 # This ensures that git history is fully fetched for proper processing
token: ${{ secrets.GITHUB_TOKEN }}

- name: Close PRs Without Linked Issues
run: |
const daysThreshold = 30;
const github = require('@actions/github');
const octokit = new github.GitHub(process.env.GITHUB_TOKEN);
const owner = github.context.repo.owner;
const repo = github.context.repo.repo;
const { data: pullRequests } = await octokit.pulls.list({ owner, repo, state: 'open' });
for (const pr of pullRequests) {
const { data: issues } = await octokit.issues.listForRepo({ owner, repo, per_page: 100 });
const linkedIssue = issues.find(issue =>
issue.pull_request && issue.pull_request.url === pr.url
);
if (!linkedIssue) {
await octokit.pulls.update({ owner, repo, pull_number: pr.number, state: 'closed' });
await octokit.issues.createComment({
owner,
repo,
issue_number: pr.number,
body: "This pull request has been closed because it does not mention the issue that it solves. Please refer to the [Contributing files](https://github.com/rupali-codes/LinksHub/blob/main/CONTRIBUTING.md#issues) to help you add this information. Then, tag the maintainers so your PR can be reopened."
});
}
}
Loading

0 comments on commit 88dcd50

Please sign in to comment.