diff --git a/.env.example b/.env.example index 5228f3a..752aee4 100644 --- a/.env.example +++ b/.env.example @@ -3,4 +3,5 @@ APP_ID=... PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n......-----END RSA PRIVATE KEY-----\n" WEBHOOK_SECRET=.... GITHUB_CLIENT_ID=Iv23ct.... -GITHUB_CLIENT_SECRET=... \ No newline at end of file +GITHUB_CLIENT_SECRET=... +PORT=3000 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..3e2b650 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,39 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG] " +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/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..7f78e3f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,18 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[FEAT] " +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..0a91628 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,25 @@ +### Description + +Please include a summary of the changes and the related issue. Explain the context and any design decisions made. + +### Related Issue + +Fixes #(issue_number) + +### Type of Change + +- [ ] Bug fix +- [ ] New feature +- [ ] Documentation update + +### Screenshots (if any): + +Please add screenshots to be easily reviewable + +### Checklist + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6143874 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,26 @@ +name: Nodejs Tests CI + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - run: npm ci + - run: npm test diff --git a/docs/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md similarity index 100% rename from docs/CODE_OF_CONDUCT.md rename to CODE_OF_CONDUCT.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c857275 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,85 @@ +## Contributing + +Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. + +Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. + +## Prerequisites + +1. Git installed +2. Node installed (Latest LTS version is preferred) + +## Set up locally + +Follow [this][setup] guide to setup the repo locally + +To know how probot works to build GitHub apps, follow [this](https://probot.github.io/docs/) guide. + +## Issues and PRs + +If you have suggestions for how this project could be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you have questions, too, we'd love to hear them. + +We'd also love PRs. If you're thinking of a large PR, we advise opening up an issue first to talk about it, though! Look at the links below if you're not sure how to open a PR. + +To get an issue assigned, use the issue-assigner bot: + +1. Comment `@issue-assigner claim` to get an issue assigned. +2. Comment `@issue-assigner abandon` to get an issue unassigned. + +## Submitting a pull request + +1. [Setup][Setup] the repo and make sure the tests pass on your machine using: `npm test` +2. Create a new branch: `git checkout -b your-branch-name` +3. Make your change, add tests, and make sure the tests still pass. +4. Push to your fork and submit a pull request, ensuring all CI/CD tests pass. +5. The PR message should contain any of the following keywords and should contain the issue number it is solving so that it gets linked in that issue: + + ``` + close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved + ``` + + Example PR message: + + ``` + This PR does this... + fixes #1 + ``` +7. Make the PR a Draft, if not ready for a review and make it Open when your PR is ready. +8. Pat your self on the back and wait for your pull request to be reviewed and merged. + +Here are a few things you can do that will increase the likelihood of your pull request being accepted: + +- Write and update tests. +- Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. +- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). + +Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you. + +## Good contributing practices + +1. Before making a PR, always fetch the current remote repo from github into local machine so that any code changes by other contributors are reflected: + + ``` + git fetch --all + ``` +2. Before making a PR rebase (not pull) your repo with upstream with the following command and solve any merge conflicts if exist: (To know more about rebase refer to this [video](https://youtu.be/4aIazhclURE?feature=shared) ): + + ``` + git rebase upstream/main + ``` +3. Do `git fetch --all` and `git rebase upstream/main` frequently to update the local repository. + +## Hacktoberfest guidelines + +1. Please focus on quality over quantity. Though documentation changes are essential, focus more on code or testing changes. +2. Abstain from making Spam PRs, otherwise label `spam` will be applied, and hacktoberfest disqualifies a user if they receive more than 2 spam labels. +3. Let's make the OpenSource community shine and lets grow together! Happy Hacking! + +## Resources + +- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) +- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) +- [GitHub Help](https://help.github.com) + +[setup]: SETUP.md +[code-of-conduct]: CODE_OF_CONDUCT.md diff --git a/README.md b/README.md index e164408..2a49a8c 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,16 @@ # GitHub Issue Assigner Bot -[contributing]: /docs/CONTRIBUTING.md -[usage]: /README.md#usage -[license]: /LICENSE - This GitHub bot helps manage issue assignments in a repository by automatically assigning or unassigning issues based on predefined rules and user commands in comments. The bot is implemented using Probot, a framework for building GitHub Apps. If you find this project helpful, please consider giving it a star ⭐ on GitHub. It helps others discover the project and shows your appreciation for the work! -See probot published app [here](https://probot.github.io/apps/issue-assigner/), and live listing on GitHub Marketplace [here](https://github.com/marketplace/issue-assigner) +See probot published app [here](https://probot.github.io/apps/issue-assigner/), live listing on GitHub Marketplace [here](https://github.com/marketplace/issue-assigner), medium article [here](https://medium.com/@Varun-Kolanu/issue-assigner-a-github-bot-built-using-probot-fa2d11f78e98) + +To join the discord server for general discussions and doubts follow the link in [this](https://github.com/Varun-Kolanu/issue-assigner/discussions/5) discussion. + +## Contributing + +See [Contributing guide][contributing] for contributing to the project. # Features @@ -75,41 +77,12 @@ Assignment and Abandoning of issues doesn't work for users having permissions ad # If the user who opened issue IS a maintainer of the repo issue-opener-is-maintainer: "Comment '@{name} claim' to get this issue assigned or '@{name} abandon' to get this issue unassigned." ``` - 3. You can remove a line from yml if you don't need that feature. 4. You can edit the values in the yml to customize the comments from the bot. 5. For example, commenting '@issue-asigner claim' will assign the issue and '@issue-assigner abandon' will remove the assignment. See these issues for seeing all features practically: [#3](https://github.com/Varun-Kolanu/issue-assigner/issues/3) and [#4](https://github.com/Varun-Kolanu/issue-assigner/issues/4) -See [Contributing guide][contributing] for contributing to the project. - -# Running in local system - -1. Clone the repo with - - ```bash - git clone https://github.com/Varun-Kolanu/issue-assigner.git - ``` - -2. Install dependencies - - ```bash - npm install - ``` - -3. Run the development server - - ```bash - npm run dev - ``` - -4. Open the link that you see in terminal to install install and configure your GitHub app. -5. You can see .env being filled with required credentials. -6. Or to configure manually, create a new github app and make a .env in the root, taking .env.example as a reference. -7. Create a `.github/issue-assigner.yml` file in the installed repo with the example configuration given [above][usage]. -8. You can test the app in your GitHub issues directly now. - # Folder structure ```bash @@ -137,3 +110,7 @@ See [Contributing guide][contributing] for contributing to the project. # License [ISC][license] © 2024 Varun Kolanu + +[contributing]: /CONTRIBUTING.md +[usage]: /README.md#usage +[license]: /LICENSE diff --git a/SETUP.md b/SETUP.md new file mode 100644 index 0000000..e6a4905 --- /dev/null +++ b/SETUP.md @@ -0,0 +1,60 @@ +# Steps to setup the repo locally + +1. Fork the repo into your account +2. Clone the forked repo and open in terminal + +```bash +git clone +``` + +2. Check whether upstream is set successfully by running: + + ``` + git remote + ``` +3. If upstream is not found, add upstream with this command: + + ``` + git remote add upstream https://github.com/Varun-Kolanu/issue-assigner.git + ``` +4. Fetch the code from remote: + + ``` + git fetch --all + ``` +5. Install dependencies + +```bash +npm install +``` + +3. Run the development server + +```bash +npm run dev +``` + + Now, open http://localhost:3000 in the browser + +## For New contributors to the repo: + +4. Click on `Register GitHub app` button and create an app by following the instructions from GitHub. Recommended approach is to create a private test repo and install the app into that repo. +5. The required environment variables will be created automatically in the .env root file +6. Restart the server by closing the terminal, opening again and running `npm run dev` to start the server. +7. The server has been setup successfully! Pat on your back :) + +## Old contributors: + +If you have already made an app in your github account and want tp use the same app again: + +4. Click on `or Use an existing GitHub app` to open the setup page +5. As said in its step 1, copy the given Webhook URL into your GitHub app's Webhook URL +6. Fill the App Id, Webhook secret fields with the info of your existing GitHub app +7. Create a New private key in the app settings and select that downloaded file in Private key field +8. Submit and you can see .env created for you in the repo's root +9. If you can't see GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET fields filled, add them manually from your GitHub app +10. Restart the server. Server setup successful! Good job :) + +### Note + +- If you get the error that PORT is already in use, create a PORT=3001 field in .env and restart the server. Our app automatically uses that PORT field to start at the desired port. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md deleted file mode 100644 index 3a2ed6a..0000000 --- a/docs/CONTRIBUTING.md +++ /dev/null @@ -1,49 +0,0 @@ -## Contributing - -[code-of-conduct]: CODE_OF_CONDUCT.md - -Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. - -Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. - -## Prerequisites - -1. Git installed -2. Node installed - -## Issues and PRs - -If you have suggestions for how this project could be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you have questions, too, we'd love to hear them. - -We'd also love PRs. If you're thinking of a large PR, we advise opening up an issue first to talk about it, though! Look at the links below if you're not sure how to open a PR. - -To get an issue assigned, use the issue-assigner bot: - -1. Comment `@issue-assigner claim` to get an issue assigned. -2. Comment `@issue-assigner abandon` to get an issue unassigned. - -## Submitting a pull request - -1. Fork and clone the repository. -2. Configure and install the dependencies: `npm install`. -3. Make sure the tests pass on your machine: `npm test`. -4. Create a new branch: `git checkout -b my-branch-name`. -5. Make your change, add tests, and make sure the tests still pass. -6. Push to your fork and submit a pull request. -7. The pull request should contain a phrase like `fixes #1`, `closes #1` etc., to get the PR linked to the issue you re trying to solve. -8. Make the PR a Draft, if not ready for a review and make it Open when your PR is ready. -9. Pat your self on the back and wait for your pull request to be reviewed and merged. - -Here are a few things you can do that will increase the likelihood of your pull request being accepted: - -- Write and update tests. -- Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. -- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). - -Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you. - -## Resources - -- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) -- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) -- [GitHub Help](https://help.github.com)