Skip to content

Commit 7df4c3d

Browse files
committed
Added team member on input and update README.md
1 parent eae3a7e commit 7df4c3d

File tree

4 files changed

+64
-4
lines changed

4 files changed

+64
-4
lines changed

README.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,55 @@
1-
# Apify PR toolkit
1+
# PR toolkit action
22

3-
This action makes Apify PR better.
3+
This action makes PR better for Zenhub integration.
44

5-
## Development
5+
# What it does
6+
7+
- Assign PR to the creator of PR
8+
- Fill missing milestone with a current milestone for the repository
9+
10+
# Action input
11+
12+
| Name | Description | Example | Required |
13+
| ------------------ | -------------------------------------------------------------------------------- | ----------------------------------------------------------- | -------- |
14+
| `repo-token` | Repository Github token | `github-token` | yes |
15+
| `team-members` | List of Github usernames for members using toolkit (by default everybody included)| `username1,username2` | no |
16+
17+
# Example usage
18+
19+
```yaml
20+
name: Apify PR toolkit
21+
22+
on:
23+
pull_request:
24+
branches:
25+
- develop
26+
27+
jobs:
28+
apify-pr-toolkit:
29+
runs-on: ubuntu-20.04
30+
steps:
31+
- name: clone pull-request-toolkit-action
32+
uses: actions/checkout@v2
33+
with:
34+
repository: apify/pull-request-toolkit-action
35+
ref: refs/tags/v1.0.0
36+
path: ./.github/actions/pull-request-toolkit-action
37+
38+
- name: run PR toolkit
39+
uses: ./.github/actions/pull-request-toolkit-action
40+
with:
41+
repo-token: ${{ secrets.GITHUB_TOKEN }}
42+
team-members: mtrunkat,gippy,drobnikj,fnesveda,mhamas,valekjo,Strajk,nguyeda1,dragonraid,jbartadev,m-murasovs
43+
```
44+
# TBD
45+
46+
- Tests
47+
- Github action for publishing new version
48+
49+
## Contribution
650
751
1. Update code in `./src`
852
2. Run `npm i`
953
3. Run `npm run all`
1054
4. Commit all changes including `./disc` folder with built code.
11-
5. Publish with new tag
55+
5. Publish a new version of action using new with new tag (It needs to be done manually)

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
repo-token:
66
required: true
77
description: 'Repository Github token'
8+
team-members:
9+
required: false
10+
description: 'List of Github usernames'
811
runs:
912
using: 'node12'
1013
main: 'dist/index.js'

dist/index.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,21 @@ async function fillCurrentMilestone(octokit: any, pullRequest: any): Promise<voi
4848
async function run(): Promise<void> {
4949
try {
5050
const repoToken = core.getInput('repo-token');
51+
const teamMembers = core.getInput('team-members');
5152
const octokit = github.getOctokit(repoToken);
5253

54+
const teamMemberList = teamMembers ? teamMembers.split(',').map((member: string) => member.trim()) : [];
5355
const pullRequest = github.context.payload.pull_request;
5456
if (!pullRequest) {
5557
core.setFailed('Action works only for PRs');
5658
return;
5759
}
5860

61+
if (pullRequest.user.login && teamMemberList.length && !teamMemberList.includes(pullRequest.user.login)) {
62+
console.log(`User ${pullRequest.user.login} is not a member of team. Skipping toolkit action.`);
63+
return;
64+
}
65+
5966
const isCreatorAssign = pullRequest.assignees.find((u: any) => u.login === pullRequest.user.login);
6067
// Assign PR to creator of PR
6168
if (!isCreatorAssign) await assignPrCreator(octokit, pullRequest);

0 commit comments

Comments
 (0)