Skip to content

Commit 146b32c

Browse files
committed
chores: write docs
1 parent d9da8ae commit 146b32c

File tree

6 files changed

+135
-6
lines changed

6 files changed

+135
-6
lines changed

.github/workflows/main.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ defaults:
99
shell: 'bash'
1010

1111
jobs:
12-
Smartrr:
12+
RequestReviews:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout repository
1616
uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
1917

2018
- name: Auto PR review requests
2119
uses: ./

LICENSE

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Uchenna Sylvester Okoro
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Pr Smartrr
2+
3+
<div style="display:flex; gap:20px; flex-wrap:wrap">
4+
<a href="https://github.com/marketplace/actions/pr-smartrr" style="text-decoration:none">
5+
<img src="https://img.shields.io/github/release/UcheSylvester/pr-smartrr.svg" />
6+
</a>
7+
8+
<a href="https://github.com/marketplace/actions/pr-smartrr" style="text-decoration:none">
9+
<img src="https://img.shields.io/badge/marketplace-pr--smartrr-green?logo=github" />
10+
</a>
11+
12+
<a href="https://github.com/marketplace/actions/pr-smartrr" style="text-decoration:none">
13+
<img src="https://img.shields.io/github/languages/top/UcheSylvester/pr-smartrr.svg" />
14+
</a>
15+
</div>
16+
17+
---
18+
19+
This GitHub Action automatically requests reviews on pull requests based on changed files.
20+
21+
It does this by checking the teammates with commits on those changed files and adding them as reviewers to pull requests. This means you do not need to manually provide a list of reviewers to this action.
22+
23+
## Inputs
24+
25+
#### `github-token`
26+
27+
**Required** The GitHub token to use for authentication. Typically, this should be set to `${{ secrets.GITHUB_TOKEN }}`.
28+
29+
#### `max-reviewers`
30+
31+
**Optional** The maximum number of reviewers to be added to the pull request. _Defaults to 2_.
32+
33+
## Usage
34+
35+
1. **Create a Workflow YAML File**: In your repository, create or edit a workflow YAML file (e.g., `.github/workflows/main.yml`).
36+
37+
2. **Define the Workflow**:
38+
39+
```yaml
40+
name: main
41+
42+
on:
43+
pull_request:
44+
types: [opened]
45+
46+
defaults:
47+
run:
48+
shell: 'bash'
49+
50+
jobs:
51+
RequestReviews:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0
58+
59+
- name: Auto PR review requests
60+
uses: UcheSylvester/pr-smartrr@v0.1.0
61+
with:
62+
github-token: ${{ secrets.GITHUB_TOKEN }}
63+
max-reviewers: 2
64+
```
65+
66+
## Run Locally
67+
68+
To run this action locally, you need to have [Node.js](https://nodejs.org/en/) installed on your machine.
69+
70+
1. Clone this repository:
71+
72+
```bash
73+
git clone
74+
```
75+
76+
2. Install dependencies:
77+
78+
```bash
79+
yarn
80+
```
81+
82+
3. Build the typescript:
83+
84+
```bash
85+
yarn build
86+
```
87+
88+
4. Run the tests:
89+
90+
```bash
91+
yarn test
92+
```
93+
94+
5. Run the local action with [nektos/act](https://github.com/nektos/act):
95+
96+
```bash
97+
act -j pr-labelr -s GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
98+
```
99+
100+
## Contributing
101+
102+
We welcome contributions from the community to make **Pr Smartrr** even better. Whether it's bug fixes, new features, or improvements to documentation, your input is valuable. To contribute, follow these steps:
103+
104+
1. Create an issue describing the feature/bug you want to work on.
105+
2. Fork the repository on GitHub.
106+
3. Create a new branch for your changes.
107+
4. Make your changes and commit them with descriptive messages.
108+
5. Submit a pull request to the main repository.
109+
110+
## License
111+
112+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
113+
114+
---
115+
116+
## Get In Touch
117+
118+
[Email](mailto:okorocode@gmail.com) | [Follow on Twitter](https://twitter.com/ucylvester) | [Connect on LinkedIn](https://www.linkedin.com/in/uchenna-okoro/) | [Report an Issue](https://github.com/UcheSylvester/pr-smartrr/issues)

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Smartrr'
1+
name: 'Pr Smartrr'
22
description: 'Automatically request reviews on pull requests based on changed files.'
33
author: 'Uchenna Sylvester Okoro'
44

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"name": "smartrr",
3-
"version": "1.0.0",
2+
"name": "pr-smartrr",
3+
"version": "0.1.0",
44
"main": "index.js",
55
"license": "MIT",
6+
"author": {
7+
"name": "Uchenna Sylvester Okoro"
8+
},
69
"scripts": {
710
"clean": "rimraf dist && rimraf lib",
811
"build": "pnpm clean && tsc && ncc build lib/index.js",

src/helpers/get-changed-files.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const getChangedFiles = async (base: string, head: string) => {
55
exec(`git diff --name-only ${base} ${head}`, (error, stdout, stderr) => {
66
if (error) return reject(new Error(error.message));
77
if (stderr) return reject(new Error(stderr));
8+
console.log('changed files', stdout);
89
resolve(stdout);
910
});
1011
});

0 commit comments

Comments
 (0)