Skip to content

Commit

Permalink
Create action
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosmoum committed Mar 19, 2020
1 parent dac32bb commit c394b2e
Show file tree
Hide file tree
Showing 4 changed files with 437 additions and 0 deletions.
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'AutoAssignReviewerTeam'
description: 'Run script that auto-assigns a team as a PR reviewer'
inputs:
githubToken:
description: 'The token to use'
required: true
teamName:
description: 'The name of the team which will be assigned as a reviewer'
required: true
runs:
using: 'node12'
main: 'index.js'
21 changes: 21 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const github = require('@actions/github');
const core = require('@actions/core');

async function run() {
const githubToken = core.getInput('githubToken');

const teamName = core.getInput('teamName');

const { pull_request: pr } = github.context.payload;

const octokit = new github.GitHub(githubToken);

octokit.pulls.createReviewRequest({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
pull_number: pr.number,
team_reviewers: [teamName]
});
}

run();
Loading

0 comments on commit c394b2e

Please sign in to comment.