Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ inputs:
description: 'True if we are deploying to production'
required: false
outputs:
PREVIOUS_TAG:
description: Previous release tag used to bound the deployment comparison
PR_LIST:
description: Array of pull request numbers
MOBILE_EXPENSIFY_PR_LIST:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ import GitUtils from '@github/libs/GitUtils';
import * as core from '@actions/core';
import * as github from '@actions/github';

async function getNewlyDeployedPullRequests(fromTag: string, toTag: string, repo: string): Promise<number[]> {
const pullRequests = await GitUtils.getPullRequestsDeployedBetween(fromTag, toTag, repo);
if (pullRequests.length === 0) {
return pullRequests;
}

// When a release branch returns to main, original merge commits appear new even if their cherry-picks
// already shipped. The reverse comparison contains those earlier cherry-picks.
const previouslyDeployedPullRequests = new Set(await GitUtils.getPullRequestsDeployedBetween(toTag, fromTag, repo));
return pullRequests.filter((pr) => !previouslyDeployedPullRequests.has(pr));
}

async function run() {
try {
const inputTag = core.getInput('TAG', {required: true});
Expand Down Expand Up @@ -62,14 +74,14 @@ async function run() {
}

console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`);
const prList = await GitUtils.getPullRequestsDeployedBetween(priorTag, inputTag, CONST.APP_REPO);
const prList = await getNewlyDeployedPullRequests(priorTag, inputTag, CONST.APP_REPO);
console.log('Found the pull request list: ', prList);
core.setOutput('PR_LIST', prList);

// Get Mobile-Expensify PRs deployed between the same tags
let mobileExpensifyPRList: number[] = [];
try {
mobileExpensifyPRList = await GitUtils.getPullRequestsDeployedBetween(priorTag, inputTag, CONST.MOBILE_EXPENSIFY_REPO);
mobileExpensifyPRList = await getNewlyDeployedPullRequests(priorTag, inputTag, CONST.MOBILE_EXPENSIFY_REPO);
console.log('Found Mobile-Expensify pull request list: ', mobileExpensifyPRList);
} catch (error) {
// Check if this is a forked repository
Expand All @@ -83,6 +95,7 @@ async function run() {
}
}
core.setOutput('MOBILE_EXPENSIFY_PR_LIST', mobileExpensifyPRList);
core.setOutput('PREVIOUS_TAG', priorTag);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
console.error(message);
Expand Down
13 changes: 11 additions & 2 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26659,6 +26659,14 @@ var GitUtils_default = {
var context2 = new Context();

// .github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts
async function getNewlyDeployedPullRequests(fromTag, toTag, repo) {
const pullRequests = await GitUtils_default.getPullRequestsDeployedBetween(fromTag, toTag, repo);
if (pullRequests.length === 0) {
return pullRequests;
}
const previouslyDeployedPullRequests = new Set(await GitUtils_default.getPullRequestsDeployedBetween(toTag, fromTag, repo));
return pullRequests.filter((pr) => !previouslyDeployedPullRequests.has(pr));
}
async function run() {
try {
const inputTag = getInput("TAG", { required: true });
Expand Down Expand Up @@ -26698,12 +26706,12 @@ async function run() {
throw new Error("Something went wrong and the prior tag could not be found.");
}
console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`);
const prList = await GitUtils_default.getPullRequestsDeployedBetween(priorTag, inputTag, CONST_default.APP_REPO);
const prList = await getNewlyDeployedPullRequests(priorTag, inputTag, CONST_default.APP_REPO);
console.log("Found the pull request list: ", prList);
setOutput("PR_LIST", prList);
let mobileExpensifyPRList = [];
try {
mobileExpensifyPRList = await GitUtils_default.getPullRequestsDeployedBetween(priorTag, inputTag, CONST_default.MOBILE_EXPENSIFY_REPO);
mobileExpensifyPRList = await getNewlyDeployedPullRequests(priorTag, inputTag, CONST_default.MOBILE_EXPENSIFY_REPO);
console.log("Found Mobile-Expensify pull request list: ", mobileExpensifyPRList);
} catch (error2) {
if (process.env.GITHUB_REPOSITORY !== `${CONST_default.GITHUB_OWNER}/${CONST_default.APP_REPO}`) {
Expand All @@ -26715,6 +26723,7 @@ async function run() {
}
}
setOutput("MOBILE_EXPENSIFY_PR_LIST", mobileExpensifyPRList);
setOutput("PREVIOUS_TAG", priorTag);
} catch (error2) {
const message = error2 instanceof Error ? error2.message : String(error2);
console.error(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ inputs:
DEPLOY_VERSION:
description: 'The app version in which the pull requests were deployed'
required: true
PREVIOUS_TAG:
description: 'Previous release tag used to bound the deployment comparison'
required: true
GITHUB_TOKEN:
description: 'Github token for authentication'
required: true
Expand Down
Loading
Loading