-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
240 changed files
with
18,569 additions
and
26,591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,8 @@ runs: | |
git config commit.gpgsign true | ||
git config user.name OSBotify | ||
git config user.email [email protected] | ||
- name: Enable debug logs for git | ||
shell: bash | ||
if: runner.debug == '1' | ||
run: echo "GIT_TRACE=true" >> "$GITHUB_ENV" |
145 changes: 0 additions & 145 deletions
145
.github/actions/composite/updateProtectedBranch/action.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,29 @@ getNumberOfItemsFromAuthorChecklist() | |
}); | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 4097: | ||
/***/ ((module) => { | ||
|
||
const CONST = { | ||
GITHUB_OWNER: 'Expensify', | ||
APP_REPO: 'App', | ||
APPLAUSE_BOT: 'applausebot', | ||
OS_BOTIFY: 'OSBotify', | ||
LABELS: { | ||
STAGING_DEPLOY: 'StagingDeployCash', | ||
DEPLOY_BLOCKER: 'DeployBlockerCash', | ||
INTERNAL_QA: 'InternalQA', | ||
}, | ||
}; | ||
|
||
CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`; | ||
CONST.APP_REPO_GIT_URL = `[email protected]:${CONST.GITHUB_OWNER}/${CONST.APP_REPO}.git`; | ||
|
||
module.exports = CONST; | ||
|
||
|
||
/***/ }), | ||
|
||
/***/ 7999: | ||
|
@@ -88,21 +111,13 @@ const core = __nccwpck_require__(2186); | |
const {GitHub, getOctokitOptions} = __nccwpck_require__(3030); | ||
const {throttling} = __nccwpck_require__(9968); | ||
const {paginateRest} = __nccwpck_require__(4193); | ||
|
||
const GITHUB_OWNER = 'Expensify'; | ||
const APP_REPO = 'App'; | ||
const APP_REPO_URL = 'https://github.com/Expensify/App'; | ||
const CONST = __nccwpck_require__(4097); | ||
|
||
const GITHUB_BASE_URL_REGEX = new RegExp('https?://(?:github\\.com|api\\.github\\.com)'); | ||
const PULL_REQUEST_REGEX = new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/pull/([0-9]+).*`); | ||
const ISSUE_REGEX = new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/issues/([0-9]+).*`); | ||
const ISSUE_OR_PULL_REQUEST_REGEX = new RegExp(`${GITHUB_BASE_URL_REGEX.source}/.*/.*/(?:pull|issues)/([0-9]+).*`); | ||
|
||
const APPLAUSE_BOT = 'applausebot'; | ||
const STAGING_DEPLOY_CASH_LABEL = 'StagingDeployCash'; | ||
const DEPLOY_BLOCKER_CASH_LABEL = 'DeployBlockerCash'; | ||
const INTERNAL_QA_LABEL = 'InternalQA'; | ||
|
||
/** | ||
* The standard rate in ms at which we'll poll the GitHub API to check for status changes. | ||
* It's 10 seconds :) | ||
|
@@ -180,20 +195,20 @@ class GithubUtils { | |
static getStagingDeployCash() { | ||
return this.octokit.issues | ||
.listForRepo({ | ||
owner: GITHUB_OWNER, | ||
repo: APP_REPO, | ||
labels: STAGING_DEPLOY_CASH_LABEL, | ||
owner: CONST.GITHUB_OWNER, | ||
repo: CONST.APP_REPO, | ||
labels: CONST.LABELS.STAGING_DEPLOY, | ||
state: 'open', | ||
}) | ||
.then(({data}) => { | ||
if (!data.length) { | ||
const error = new Error(`Unable to find ${STAGING_DEPLOY_CASH_LABEL} issue.`); | ||
const error = new Error(`Unable to find ${CONST.LABELS.STAGING_DEPLOY} issue.`); | ||
error.code = 404; | ||
throw error; | ||
} | ||
|
||
if (data.length > 1) { | ||
const error = new Error(`Found more than one ${STAGING_DEPLOY_CASH_LABEL} issue.`); | ||
const error = new Error(`Found more than one ${CONST.LABELS.STAGING_DEPLOY} issue.`); | ||
error.code = 500; | ||
throw error; | ||
} | ||
|
@@ -226,7 +241,7 @@ class GithubUtils { | |
tag, | ||
}; | ||
} catch (exception) { | ||
throw new Error(`Unable to find ${STAGING_DEPLOY_CASH_LABEL} issue with correct data.`); | ||
throw new Error(`Unable to find ${CONST.LABELS.STAGING_DEPLOY} issue with correct data.`); | ||
} | ||
} | ||
|
||
|
@@ -325,16 +340,13 @@ class GithubUtils { | |
) { | ||
return this.fetchAllPullRequests(_.map(PRList, this.getPullRequestNumberFromURL)) | ||
.then((data) => { | ||
const automatedPRs = _.pluck(_.filter(data, GithubUtils.isAutomatedPullRequest), 'html_url'); | ||
console.log('Filtering out the following automated pull requests:', automatedPRs); | ||
|
||
// The format of this map is following: | ||
// { | ||
// 'https://github.com/Expensify/App/pull/9641': [ 'PauloGasparSv', 'kidroca' ], | ||
// 'https://github.com/Expensify/App/pull/9642': [ 'mountiny', 'kidroca' ] | ||
// } | ||
const internalQAPRMap = _.reduce( | ||
_.filter(data, (pr) => !_.isEmpty(_.findWhere(pr.labels, {name: INTERNAL_QA_LABEL}))), | ||
_.filter(data, (pr) => !_.isEmpty(_.findWhere(pr.labels, {name: CONST.LABELS.INTERNAL_QA}))), | ||
(map, pr) => { | ||
// eslint-disable-next-line no-param-reassign | ||
map[pr.html_url] = _.compact(_.pluck(pr.assignees, 'login')); | ||
|
@@ -351,7 +363,7 @@ class GithubUtils { | |
console.log('Found the following NO QA PRs:', noQAPRs); | ||
const verifiedOrNoQAPRs = _.union(verifiedPRList, noQAPRs); | ||
|
||
const sortedPRList = _.chain(PRList).difference(automatedPRs).difference(_.keys(internalQAPRMap)).unique().sortBy(GithubUtils.getPullRequestNumberFromURL).value(); | ||
const sortedPRList = _.chain(PRList).difference(_.keys(internalQAPRMap)).unique().sortBy(GithubUtils.getPullRequestNumberFromURL).value(); | ||
const sortedDeployBlockers = _.sortBy(_.unique(deployBlockers), GithubUtils.getIssueOrPullRequestNumberFromURL); | ||
|
||
// Tag version and comparison URL | ||
|
@@ -408,7 +420,7 @@ class GithubUtils { | |
issueBody += '\r\n\r\ncc @Expensify/applauseleads\r\n'; | ||
return issueBody; | ||
}) | ||
.catch((err) => console.warn('Error generating StagingDeployCash issue body!', 'Automated PRs may not be properly filtered out. Continuing...', err)); | ||
.catch((err) => console.warn('Error generating StagingDeployCash issue body! Continuing...', err)); | ||
} | ||
|
||
/** | ||
|
@@ -422,8 +434,8 @@ class GithubUtils { | |
return this.paginate( | ||
this.octokit.pulls.list, | ||
{ | ||
owner: GITHUB_OWNER, | ||
repo: APP_REPO, | ||
owner: CONST.GITHUB_OWNER, | ||
repo: CONST.APP_REPO, | ||
state: 'all', | ||
sort: 'created', | ||
direction: 'desc', | ||
|
@@ -447,8 +459,8 @@ class GithubUtils { | |
static getPullRequestBody(pullRequestNumber) { | ||
return this.octokit.pulls | ||
.get({ | ||
owner: GITHUB_OWNER, | ||
repo: APP_REPO, | ||
owner: CONST.GITHUB_OWNER, | ||
repo: CONST.APP_REPO, | ||
pull_number: pullRequestNumber, | ||
}) | ||
.then(({data: pullRequestComment}) => pullRequestComment.body); | ||
|
@@ -462,8 +474,8 @@ class GithubUtils { | |
return this.paginate( | ||
this.octokit.pulls.listReviews, | ||
{ | ||
owner: GITHUB_OWNER, | ||
repo: APP_REPO, | ||
owner: CONST.GITHUB_OWNER, | ||
repo: CONST.APP_REPO, | ||
pull_number: pullRequestNumber, | ||
per_page: 100, | ||
}, | ||
|
@@ -479,8 +491,8 @@ class GithubUtils { | |
return this.paginate( | ||
this.octokit.issues.listComments, | ||
{ | ||
owner: GITHUB_OWNER, | ||
repo: APP_REPO, | ||
owner: CONST.GITHUB_OWNER, | ||
repo: CONST.APP_REPO, | ||
issue_number: issueNumber, | ||
per_page: 100, | ||
}, | ||
|
@@ -499,7 +511,7 @@ class GithubUtils { | |
static createComment(repo, number, messageBody) { | ||
console.log(`Writing comment on #${number}`); | ||
return this.octokit.issues.createComment({ | ||
owner: GITHUB_OWNER, | ||
owner: CONST.GITHUB_OWNER, | ||
repo, | ||
issue_number: number, | ||
body: messageBody, | ||
|
@@ -516,8 +528,8 @@ class GithubUtils { | |
console.log(`Fetching New Expensify workflow runs for ${workflow}...`); | ||
return this.octokit.actions | ||
.listWorkflowRuns({ | ||
owner: GITHUB_OWNER, | ||
repo: APP_REPO, | ||
owner: CONST.GITHUB_OWNER, | ||
repo: CONST.APP_REPO, | ||
workflow_id: workflow, | ||
}) | ||
.then((response) => lodashGet(response, 'data.workflow_runs[0].id')); | ||
|
@@ -540,7 +552,7 @@ class GithubUtils { | |
* @returns {String} | ||
*/ | ||
static getPullRequestURLFromNumber(number) { | ||
return `${APP_REPO_URL}/pull/${number}`; | ||
return `${CONST.APP_REPO_URL}/pull/${number}`; | ||
} | ||
|
||
/** | ||
|
@@ -588,16 +600,6 @@ class GithubUtils { | |
return Number.parseInt(matches[1], 10); | ||
} | ||
|
||
/** | ||
* Determine if a given pull request is an automated PR. | ||
* | ||
* @param {Object} pullRequest | ||
* @returns {Boolean} | ||
*/ | ||
static isAutomatedPullRequest(pullRequest) { | ||
return _.isEqual(lodashGet(pullRequest, 'user.login', ''), 'OSBotify'); | ||
} | ||
|
||
/** | ||
* Return the login of the actor who closed an issue or PR. If the issue is not closed, return an empty string. | ||
* | ||
|
@@ -606,8 +608,8 @@ class GithubUtils { | |
*/ | ||
static getActorWhoClosedIssue(issueNumber) { | ||
return this.paginate(this.octokit.issues.listEvents, { | ||
owner: GITHUB_OWNER, | ||
repo: APP_REPO, | ||
owner: CONST.GITHUB_OWNER, | ||
repo: CONST.APP_REPO, | ||
issue_number: issueNumber, | ||
per_page: 100, | ||
}) | ||
|
@@ -617,12 +619,6 @@ class GithubUtils { | |
} | ||
|
||
module.exports = GithubUtils; | ||
module.exports.GITHUB_OWNER = GITHUB_OWNER; | ||
module.exports.APP_REPO = APP_REPO; | ||
module.exports.APP_REPO_URL = APP_REPO_URL; | ||
module.exports.STAGING_DEPLOY_CASH_LABEL = STAGING_DEPLOY_CASH_LABEL; | ||
module.exports.DEPLOY_BLOCKER_CASH_LABEL = DEPLOY_BLOCKER_CASH_LABEL; | ||
module.exports.APPLAUSE_BOT = APPLAUSE_BOT; | ||
module.exports.ISSUE_OR_PULL_REQUEST_REGEX = ISSUE_OR_PULL_REQUEST_REGEX; | ||
module.exports.POLL_RATE = POLL_RATE; | ||
|
||
|
Oops, something went wrong.