Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/0xmiroslav/Expensify into i…
Browse files Browse the repository at this point in the history
…ssue-18706-split-amount-iou-preview
  • Loading branch information
0xmiroslav committed May 12, 2023
2 parents dadb281 + 756e9d8 commit f9b9377
Show file tree
Hide file tree
Showing 78 changed files with 1,164 additions and 674 deletions.
1 change: 1 addition & 0 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,53 @@ if (titleRegex) {
}

/**
* Process a pull request and outputs it's merge commit hash.
* Output pull request merge actor.
*
* @param {Object} PR
*/
function outputMergeCommitHash(PR) {
if (!_.isEmpty(PR)) {
console.log(`Found matching pull request: ${PR.html_url}`);
core.setOutput('MERGE_COMMIT_SHA', PR.merge_commit_sha);
function outputMergeActor(PR) {
if (user === 'OSBotify') {
core.setOutput('MERGE_ACTOR', PR.merged_by.login);
} else {
const err = new Error('Could not find matching pull request');
console.error(err);
core.setFailed(err);
core.setOutput('MERGE_ACTOR', user);
}
}

/**
* Process a pull request and outputs it's merge actor
* Output forked repo URL if PR includes changes from a fork.
*
* @param {Object} PR
*/
function outputMergeActor(PR) {
function outputForkedRepoUrl(PR) {
if (PR.head.repo.html_url === GithubUtils.APP_REPO_URL) {
core.setOutput('FORKED_REPO_URL', '');
} else {
core.setOutput('FORKED_REPO_URL', `${PR.head.repo.html_url}.git`);
}
}

/**
* Output pull request data.
*
* @param {Object} PR
*/
function outputPullRequestData(PR) {
core.setOutput('MERGE_COMMIT_SHA', PR.merge_commit_sha);
core.setOutput('HEAD_COMMIT_SHA', PR.head.sha);
core.setOutput('IS_MERGED', PR.merged);
outputMergeActor(PR);
outputForkedRepoUrl(PR);
}

/**
* Process a pull request and output its data.
*
* @param {Object} PR
*/
function processPullRequest(PR) {
if (!_.isEmpty(PR)) {
console.log(`Found matching pull request: ${PR.html_url}`);

if (user === 'OSBotify') {
core.setOutput('MERGE_ACTOR', PR.merged_by.login);
} else {
core.setOutput('MERGE_ACTOR', user);
}
outputPullRequestData(PR);
} else {
const err = new Error('Could not find matching pull request');
console.error(err);
Expand All @@ -79,8 +97,7 @@ if (pullRequestNumber) {
pull_number: pullRequestNumber,
})
.then(({data}) => {
outputMergeCommitHash(data);
outputMergeActor(data);
processPullRequest(data);
})
.catch(handleUnknownError);
} else {
Expand All @@ -97,7 +114,6 @@ if (pullRequestNumber) {
}),
)
.then(({data}) => {
outputMergeCommitHash(data);
outputMergeActor(data);
processPullRequest(data);
});
}
57 changes: 37 additions & 20 deletions .github/actions/javascript/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,53 @@ if (titleRegex) {
}

/**
* Process a pull request and outputs it's merge commit hash.
* Output pull request merge actor.
*
* @param {Object} PR
*/
function outputMergeCommitHash(PR) {
if (!_.isEmpty(PR)) {
console.log(`Found matching pull request: ${PR.html_url}`);
core.setOutput('MERGE_COMMIT_SHA', PR.merge_commit_sha);
function outputMergeActor(PR) {
if (user === 'OSBotify') {
core.setOutput('MERGE_ACTOR', PR.merged_by.login);
} else {
const err = new Error('Could not find matching pull request');
console.error(err);
core.setFailed(err);
core.setOutput('MERGE_ACTOR', user);
}
}

/**
* Process a pull request and outputs it's merge actor
* Output forked repo URL if PR includes changes from a fork.
*
* @param {Object} PR
*/
function outputMergeActor(PR) {
function outputForkedRepoUrl(PR) {
if (PR.head.repo.html_url === GithubUtils.APP_REPO_URL) {
core.setOutput('FORKED_REPO_URL', '');
} else {
core.setOutput('FORKED_REPO_URL', `${PR.head.repo.html_url}.git`);
}
}

/**
* Output pull request data.
*
* @param {Object} PR
*/
function outputPullRequestData(PR) {
core.setOutput('MERGE_COMMIT_SHA', PR.merge_commit_sha);
core.setOutput('HEAD_COMMIT_SHA', PR.head.sha);
core.setOutput('IS_MERGED', PR.merged);
outputMergeActor(PR);
outputForkedRepoUrl(PR);
}

/**
* Process a pull request and output its data.
*
* @param {Object} PR
*/
function processPullRequest(PR) {
if (!_.isEmpty(PR)) {
console.log(`Found matching pull request: ${PR.html_url}`);

if (user === 'OSBotify') {
core.setOutput('MERGE_ACTOR', PR.merged_by.login);
} else {
core.setOutput('MERGE_ACTOR', user);
}
outputPullRequestData(PR);
} else {
const err = new Error('Could not find matching pull request');
console.error(err);
Expand All @@ -89,8 +107,7 @@ if (pullRequestNumber) {
pull_number: pullRequestNumber,
})
.then(({data}) => {
outputMergeCommitHash(data);
outputMergeActor(data);
processPullRequest(data);
})
.catch(handleUnknownError);
} else {
Expand All @@ -107,8 +124,7 @@ if (pullRequestNumber) {
}),
)
.then(({data}) => {
outputMergeCommitHash(data);
outputMergeActor(data);
processPullRequest(data);
});
}

Expand Down Expand Up @@ -701,6 +717,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/getReleaseBody/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/isPullRequestMergeable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/isStagingDeployLocked/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/postTestBuildComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/reopenIssueWithComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/reviewerChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/triggerWorkflowAndWait/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/actions/javascript/verifySignedCommits/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ 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;
Expand Down
1 change: 1 addition & 0 deletions .github/libs/GithubUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ 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;
Expand Down
Loading

0 comments on commit f9b9377

Please sign in to comment.