Skip to content

Commit

Permalink
Merge pull request #46243 from Expensify/Rory-FixReleaseNames
Browse files Browse the repository at this point in the history
[No QA] Prettier releases
  • Loading branch information
AndrewGable authored Jul 26, 2024
2 parents 36ed8e0 + e1f5649 commit 3ff64b9
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 109 deletions.
6 changes: 0 additions & 6 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17417,12 +17417,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12658,12 +12658,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11941,12 +11941,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14971,12 +14971,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/getArtifactInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11902,12 +11902,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12254,12 +12254,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/getPullRequestDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12004,12 +12004,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
26 changes: 23 additions & 3 deletions .github/actions/javascript/getReleaseBody/getReleaseBody.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
import * as core from '@actions/core';
import type {components as OctokitComponents} from '@octokit/openapi-types';
import * as ActionUtils from '@github/libs/ActionUtils';
import GithubUtils from '@github/libs/GithubUtils';

type GitHubPR = OctokitComponents['schemas']['pull-request-simple'];

// Parse the stringified JSON array of PR numbers, and cast each from String -> Number
const PRList = ActionUtils.getJSONInput('PR_LIST', {required: true}) as number[];
console.log('Got PR list: ', String(PRList));

const releaseBody = GithubUtils.getReleaseBody(PRList);
console.log(`Generated release body: ${releaseBody}`);
/**
* Generate the well-formatted body of a production release.
*/
function getReleaseBody(pullRequests: GitHubPR[]): string {
return pullRequests.map((pr) => `- ${pr.title} by ${pr.user?.login ?? 'unknown'} in ${pr.html_url}`).join('\r\n');
}

async function run() {
const allPRs = await GithubUtils.fetchAllPullRequests(PRList);
if (!allPRs) {
core.setFailed(`something went wrong getting PRList ${JSON.stringify(PRList)}`);
return;
}
const releaseBody = getReleaseBody(allPRs);
console.log(`Generated release body: ${releaseBody}`);
core.setOutput('RELEASE_BODY', releaseBody);
}

core.setOutput('RELEASE_BODY', releaseBody);
if (require.main === module) {
run();
}
28 changes: 19 additions & 9 deletions .github/actions/javascript/getReleaseBody/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11459,9 +11459,25 @@ const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
// Parse the stringified JSON array of PR numbers, and cast each from String -> Number
const PRList = ActionUtils.getJSONInput('PR_LIST', { required: true });
console.log('Got PR list: ', String(PRList));
const releaseBody = GithubUtils_1.default.getReleaseBody(PRList);
console.log(`Generated release body: ${releaseBody}`);
core.setOutput('RELEASE_BODY', releaseBody);
/**
* Generate the well-formatted body of a production release.
*/
function getReleaseBody(pullRequests) {
return pullRequests.map((pr) => `- ${pr.title} by ${pr.user?.login ?? 'unknown'} in ${pr.html_url}`).join('\r\n');
}
async function run() {
const allPRs = await GithubUtils_1.default.fetchAllPullRequests(PRList);
if (!allPRs) {
core.setFailed(`something went wrong getting PRList ${JSON.stringify(PRList)}`);
return;
}
const releaseBody = getReleaseBody(allPRs);
console.log(`Generated release body: ${releaseBody}`);
core.setOutput('RELEASE_BODY', releaseBody);
}
if (require.main === require.cache[eval('__filename')]) {
run();
}


/***/ }),
Expand Down Expand Up @@ -11948,12 +11964,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/isStagingDeployLocked/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11902,12 +11902,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12109,12 +12109,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/postTestBuildComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12001,12 +12001,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/reopenIssueWithComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11912,12 +11912,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/reviewerChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12004,12 +12004,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 0 additions & 6 deletions .github/actions/javascript/verifySignedCommits/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11944,12 +11944,6 @@ class GithubUtils {
})
.then((response) => response.data.workflow_runs[0]?.id);
}
/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests) {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}
/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
7 changes: 0 additions & 7 deletions .github/libs/GithubUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,6 @@ class GithubUtils {
.then((response) => response.data.workflow_runs[0]?.id);
}

/**
* Generate the well-formatted body of a production release.
*/
static getReleaseBody(pullRequests: number[]): string {
return pullRequests.map((number) => `- ${this.getPullRequestURLFromNumber(number)}`).join('\r\n');
}

/**
* Generate the URL of an New Expensify pull request given the PR number.
*/
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: 🚀 Push tags to trigger staging deploy 🚀
run: git push --tags

- name: Warn deployers if staging deploy failed
if: ${{ failure() }}
uses: 8398a7/action-slack@v3
Expand Down Expand Up @@ -83,10 +83,10 @@ jobs:
PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }}

- name: 🚀 Create release to trigger production deploy 🚀
run: gh release create ${{ env.PRODUCTION_VERSION }} --notes '${{ steps.getReleaseBody.outputs.RELEASE_BODY }}'
run: gh release create ${{ env.PRODUCTION_VERSION }} --title ${{ env.PRODUCTION_VERSION }} --notes '${{ steps.getReleaseBody.outputs.RELEASE_BODY }}'
env:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}

- name: Warn deployers if production deploy failed
if: ${{ failure() }}
uses: 8398a7/action-slack@v3
Expand Down
9 changes: 0 additions & 9 deletions tests/unit/GithubUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,13 +621,4 @@ describe('GithubUtils', () => {
[54321, 'https://github.com/Expensify/App/pull/54321'],
])('getPullRequestNumberFromURL("%s")', (input, expectedOutput) => expect(GithubUtils.getPullRequestURLFromNumber(input)).toBe(expectedOutput));
});

describe('getReleaseBody', () => {
test.each([
// eslint-disable-next-line max-len
[[1, 2, 3], '- https://github.com/Expensify/App/pull/1\r\n- https://github.com/Expensify/App/pull/2\r\n- https://github.com/Expensify/App/pull/3'],
[[], ''],
[[12345], '- https://github.com/Expensify/App/pull/12345'],
])('getReleaseBody("%s")', (input, expectedOutput) => expect(GithubUtils.getReleaseBody(input)).toBe(expectedOutput));
});
});

0 comments on commit 3ff64b9

Please sign in to comment.