Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ inputs:
required: true

runs:
using: "node12"
using: "node20"
main: "actions_build/index.js"
30 changes: 15 additions & 15 deletions actions/src/issues/checkIssueLabels.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
*/

const core = require('@actions/core');
const { context, GitHub } = require('@actions/github');
const github = require('@actions/github');
const whitelist = require('../../../userWhitelist.json');
const GOOD_FIRST_LABEL = 'good first issue';
const prLabels = ['dependencies', 'stale'];

const checkLabels = async () => {
core.info('Checking newly added label...');
const token = core.getInput('repo-token');
const label = context.payload.label;
const octokit = new GitHub(token);
const user = context.payload.sender.login;
const label = github.context.payload.label;
const octokit = github.getOctokit(token);
const user = github.context.payload.sender.login;

if (
label.name === GOOD_FIRST_LABEL &&
Expand All @@ -48,28 +48,28 @@ const checkLabels = async () => {
* @param {String} user - Username of the user that added the label.
*/
const handleGoodFirstIssueLabel = async (octokit, user) => {
const issueNumber = context.payload.issue.number;
const issueNumber = github.context.payload.issue.number;
// Comment on the issue and ping the onboarding team lead.
var commentBody = (
'Hi @' + user + ', only certain users are allowed to add good ' +
'first issue labels. Looping in @oppia/oppia-good-first-issue-labelers ' +
'first issue labels. Looping in @oppia/oppia-good-first-issue-labelers ' +
'to add the label. Thanks!'
);
await octokit.issues.createComment(
{
body: commentBody,
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
}
);
// Remove the label.
core.info('Removing the label.');
await octokit.issues.removeLabel({
issue_number: issueNumber,
name: GOOD_FIRST_LABEL,
owner: context.repo.owner,
repo: context.repo.repo
owner: github.context.repo.owner,
repo: github.context.repo.repo
});
};

Expand All @@ -81,7 +81,7 @@ const handleGoodFirstIssueLabel = async (octokit, user) => {
* @param {String} user - Username of the user that added the label.
*/
const handlePRLabel = async (octokit, label, user) => {
const issueNumber = context.payload.issue.number;
const issueNumber = github.context.payload.issue.number;
const linkText = 'here';
// Add link to wiki.
const link = linkText.link(
Expand All @@ -96,8 +96,8 @@ const handlePRLabel = async (octokit, label, user) => {
{
body: commentBody,
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
}
);

Expand All @@ -106,8 +106,8 @@ const handlePRLabel = async (octokit, label, user) => {
await octokit.issues.removeLabel({
issue_number: issueNumber,
name: label,
owner: context.repo.owner,
repo: context.repo.repo
owner: github.context.repo.owner,
repo: github.context.repo.repo
});
};

Expand Down
10 changes: 5 additions & 5 deletions actions/src/pull_requests/checkWipDraftPR.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

const core = require('@actions/core');
const { context, GitHub } = require('@actions/github');
const github = require('@actions/github');
const { commentAndAssignUsers } = require('../utils');

/**
Expand All @@ -44,11 +44,11 @@ const isWIPPr = ({ title, body }) => {
* @returns {Promise<Boolean>}
*/
const isSkipCICommit = async (octokit) => {
const pullRequest = context.payload.pull_request;
const pullRequest = github.context.payload.pull_request;

const commitParams = {
commit_sha: pullRequest.head.sha,
...context.repo
...github.context.repo
};
const commitResponse = await octokit.git.getCommit(commitParams);

Expand All @@ -60,8 +60,8 @@ const isSkipCICommit = async (octokit) => {

module.exports.checkWIP = async () => {
const token = core.getInput('repo-token');
const octokit = new GitHub(token);
const pullRequest = context.payload.pull_request;
const octokit = github.getOctokit(token);
const pullRequest = github.context.payload.pull_request;
const prAuthor = pullRequest.user.login;

if (isDraftPr(pullRequest) || isWIPPr(pullRequest)) {
Expand Down
20 changes: 10 additions & 10 deletions actions/src/pull_requests/claCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

const core = require('@actions/core');
const { context, GitHub } = require('@actions/github');
const github = require('@actions/github');
const { google } = require('googleapis');

/**
Expand All @@ -44,10 +44,10 @@ const authorize = async function() {

const generateOutput = async (hasClaSigned) => {
const GITHUB_TOKEN = core.getInput('repo-token');
const octokit = new GitHub(GITHUB_TOKEN);
const PR_NUMBER = context.payload.pull_request.number;
const PR_AUTHOR = context.payload.pull_request.user.login;
const REPO_NAME = context.payload.repository.name;
const octokit = github.getOctokit(GITHUB_TOKEN);
const PR_NUMBER = github.context.payload.pull_request.number;
const PR_AUTHOR = github.context.payload.pull_request.user.login;
const REPO_NAME = github.context.payload.repository.name;

let LINK_RESULT = '';

Expand Down Expand Up @@ -76,15 +76,15 @@ const generateOutput = async (hasClaSigned) => {
await octokit.issues.update({
issue_number: PR_NUMBER,
state: 'closed',
owner: context.repo.owner,
repo: context.repo.repo,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
});
await octokit.issues.createComment(
{
body: comment,
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
}
);
core.setFailed(PR_AUTHOR + ' has not signed the CLA');
Expand All @@ -99,7 +99,7 @@ const generateOutput = async (hasClaSigned) => {
* @param {google.auth.OAuth2} auth The authenticated Google OAuth client.
*/
const checkSheet = async (auth) => {
const PR_AUTHOR = context.payload.pull_request.user.login;
const PR_AUTHOR = github.context.payload.pull_request.user.login;
const sheets = google.sheets({ version: 'v4', auth });
const SPREADSHEET_ID = core.getInput('cla-sheet-id');
await sheets.spreadsheets.values.get(
Expand Down
Loading
Loading