1717 */
1818
1919const core = require ( '@actions/core' ) ;
20- const { context , GitHub } = require ( '@actions/github' ) ;
20+ const github = require ( '@actions/github' ) ;
2121const whitelist = require ( '../../../userWhitelist.json' ) ;
2222const GOOD_FIRST_LABEL = 'good first issue' ;
2323const prLabels = [ 'dependencies' , 'stale' ] ;
2424
2525const checkLabels = async ( ) => {
2626 core . info ( 'Checking newly added label...' ) ;
2727 const token = core . getInput ( 'repo-token' ) ;
28- const label = context . payload . label ;
29- const octokit = new GitHub ( token ) ;
30- const user = context . payload . sender . login ;
28+ const label = github . context . payload . label ;
29+ const octokit = github . getOctokit ( token ) ;
30+ const user = github . context . payload . sender . login ;
3131
3232 if (
3333 label . name === GOOD_FIRST_LABEL &&
@@ -48,28 +48,28 @@ const checkLabels = async () => {
4848 * @param {String } user - Username of the user that added the label.
4949 */
5050const handleGoodFirstIssueLabel = async ( octokit , user ) => {
51- const issueNumber = context . payload . issue . number ;
51+ const issueNumber = github . context . payload . issue . number ;
5252 // Comment on the issue and ping the onboarding team lead.
5353 var commentBody = (
5454 'Hi @' + user + ', only certain users are allowed to add good ' +
55- 'first issue labels. Looping in @oppia/oppia-good-first-issue-labelers ' +
55+ 'first issue labels. Looping in @oppia/oppia-good-first-issue-labelers ' +
5656 'to add the label. Thanks!'
5757 ) ;
5858 await octokit . issues . createComment (
5959 {
6060 body : commentBody ,
6161 issue_number : issueNumber ,
62- owner : context . repo . owner ,
63- repo : context . repo . repo ,
62+ owner : github . context . repo . owner ,
63+ repo : github . context . repo . repo ,
6464 }
6565 ) ;
6666 // Remove the label.
6767 core . info ( 'Removing the label.' ) ;
6868 await octokit . issues . removeLabel ( {
6969 issue_number : issueNumber ,
7070 name : GOOD_FIRST_LABEL ,
71- owner : context . repo . owner ,
72- repo : context . repo . repo
71+ owner : github . context . repo . owner ,
72+ repo : github . context . repo . repo
7373 } ) ;
7474} ;
7575
@@ -81,7 +81,7 @@ const handleGoodFirstIssueLabel = async (octokit, user) => {
8181 * @param {String } user - Username of the user that added the label.
8282 */
8383const handlePRLabel = async ( octokit , label , user ) => {
84- const issueNumber = context . payload . issue . number ;
84+ const issueNumber = github . context . payload . issue . number ;
8585 const linkText = 'here' ;
8686 // Add link to wiki.
8787 const link = linkText . link (
@@ -96,8 +96,8 @@ const handlePRLabel = async (octokit, label, user) => {
9696 {
9797 body : commentBody ,
9898 issue_number : issueNumber ,
99- owner : context . repo . owner ,
100- repo : context . repo . repo ,
99+ owner : github . context . repo . owner ,
100+ repo : github . context . repo . repo ,
101101 }
102102 ) ;
103103
@@ -106,8 +106,8 @@ const handlePRLabel = async (octokit, label, user) => {
106106 await octokit . issues . removeLabel ( {
107107 issue_number : issueNumber ,
108108 name : label ,
109- owner : context . repo . owner ,
110- repo : context . repo . repo
109+ owner : github . context . repo . owner ,
110+ repo : github . context . repo . repo
111111 } ) ;
112112} ;
113113
0 commit comments