Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
Browse files Browse the repository at this point in the history
…ture/29582-pin-workspace-chat
  • Loading branch information
rezkiy37 committed Nov 20, 2023
2 parents 7af333f + aeced9a commit c2aa07c
Show file tree
Hide file tree
Showing 731 changed files with 14,154 additions and 13,857 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/node_modules/*
**/dist/*
.github/actions/**/index.js"
docs/vendor/**
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# Every PR gets a review from an internal Expensify engineer
* @Expensify/pullerbear

# Every PR that touches redirects gets reviewed by ring0
docs/redirects.csv @Expensify/infra
6 changes: 3 additions & 3 deletions .github/actions/composite/setupGitForOSBotifyApp/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ runs:
shell: bash
run: |
if [[ -f .github/workflows/OSBotify-private-key.asc.gpg ]]; then
echo "::set-output name=key_exists::true"
echo "key_exists=true" >> "$GITHUB_OUTPUT"
fi
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
if: steps.key_check.outputs.key_exists != 'true'
with:
sparse-checkout: |
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/composite/setupNode/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Set up Node
runs:
using: composite
steps:
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/javascript/authorChecklist/authorChecklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function checkPRForCompletedChecklist(expectedNumberOfChecklistItems: number, ch

async function generateDynamicChecksAndCheckForCompletion() {
// Generate dynamic checks
console.log('Generating dynamic checks...');
const dynamicChecks = await getChecklistCategoriesForPullRequest();
let isPassing = true;
let didChecklistChange = false;
Expand All @@ -91,13 +92,15 @@ async function generateDynamicChecksAndCheckForCompletion() {
const regex = new RegExp(`- \\[([ x])] ${escapeRegExp(check)}`);
const match = regex.exec(checklist);
if (!match) {
console.log('Adding check to the checklist:', check);
// Add it to the PR body
isPassing = false;
checklist += `- [ ] ${check}\r\n`;
didChecklistChange = true;
} else {
const isChecked = match[1] === 'x';
if (!isChecked) {
console.log('Found unchecked checklist item:', check);
isPassing = false;
}
}
Expand All @@ -112,6 +115,7 @@ async function generateDynamicChecksAndCheckForCompletion() {
const match = regex.exec(checklist);
if (match) {
// Remove it from the PR body
console.log('Check has been removed from the checklist:', check);
checklist = checklist.replace(match[0], '');
didChecklistChange = true;
}
Expand All @@ -123,6 +127,7 @@ async function generateDynamicChecksAndCheckForCompletion() {

// Update the PR body
if (didChecklistChange) {
console.log('Checklist changed, updating PR...');
await GithubUtils.octokit.pulls.update({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const CONST = {
DEPLOY_BLOCKER: 'DeployBlockerCash',
INTERNAL_QA: 'InternalQA',
},
DATE_FORMAT_STRING: 'yyyy-MM-dd',
};

CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`;
Expand Down Expand Up @@ -21574,6 +21575,7 @@ function checkPRForCompletedChecklist(expectedNumberOfChecklistItems, checklist)
}
async function generateDynamicChecksAndCheckForCompletion() {
// Generate dynamic checks
console.log('Generating dynamic checks...');
const dynamicChecks = await getChecklistCategoriesForPullRequest();
let isPassing = true;
let didChecklistChange = false;
Expand All @@ -21585,6 +21587,7 @@ async function generateDynamicChecksAndCheckForCompletion() {
const regex = new RegExp(`- \\[([ x])] ${(0, escapeRegExp_1.default)(check)}`);
const match = regex.exec(checklist);
if (!match) {
console.log('Adding check to the checklist:', check);
// Add it to the PR body
isPassing = false;
checklist += `- [ ] ${check}\r\n`;
Expand All @@ -21593,6 +21596,7 @@ async function generateDynamicChecksAndCheckForCompletion() {
else {
const isChecked = match[1] === 'x';
if (!isChecked) {
console.log('Found unchecked checklist item:', check);
isPassing = false;
}
}
Expand All @@ -21605,6 +21609,7 @@ async function generateDynamicChecksAndCheckForCompletion() {
const match = regex.exec(checklist);
if (match) {
// Remove it from the PR body
console.log('Check has been removed from the checklist:', check);
checklist = checklist.replace(match[0], '');
didChecklistChange = true;
}
Expand All @@ -21614,6 +21619,7 @@ async function generateDynamicChecksAndCheckForCompletion() {
const newBody = contentBeforeChecklist + checklistStartsWith + checklist + checklistEndsWith + contentAfterChecklist;
// Update the PR body
if (didChecklistChange) {
console.log('Checklist changed, updating PR...');
await GithubUtils_1.default.octokit.pulls.update({
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/awaitStagingDeploys/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ inputs:
description: If provided, this action will only wait for a deploy matching this tag.
required: false
runs:
using: 'node16'
using: 'node20'
main: './index.js'
1 change: 1 addition & 0 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ const CONST = {
DEPLOY_BLOCKER: 'DeployBlockerCash',
INTERNAL_QA: 'InternalQA',
},
DATE_FORMAT_STRING: 'yyyy-MM-dd',
};

CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`;
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/bumpVersion/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ outputs:
NEW_VERSION:
description: The new semver version of the application, updated in the JS and native layers.
runs:
using: 'node16'
using: 'node20'
main: './index.js'
2 changes: 1 addition & 1 deletion .github/actions/javascript/checkDeployBlockers/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ outputs:
HAS_DEPLOY_BLOCKERS:
description: A true/false indicating whether or not a deploy blocker was found.
runs:
using: 'node16'
using: 'node20'
main: 'index.js'
1 change: 1 addition & 0 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const CONST = {
DEPLOY_BLOCKER: 'DeployBlockerCash',
INTERNAL_QA: 'InternalQA',
},
DATE_FORMAT_STRING: 'yyyy-MM-dd',
};

CONST.APP_REPO_URL = `https://github.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ inputs:
GITHUB_TOKEN:
description: Auth token for New Expensify Github
required: true
NPM_VERSION:
description: The new NPM version of the StagingDeployCash issue.
required: false

runs:
using: 'node16'
using: 'node20'
main: './index.js'
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const fs = require('fs');
const format = require('date-fns/format');
const _ = require('underscore');
const core = require('@actions/core');
const moment = require('moment');
const CONST = require('../../../libs/CONST');
const GithubUtils = require('../../../libs/GithubUtils');
const GitUtils = require('../../../libs/GitUtils');

async function run() {
const newVersion = core.getInput('NPM_VERSION');
console.log('New version found from action input:', newVersion);
// Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time
const newVersionTag = JSON.parse(fs.readFileSync('package.json')).version;

try {
// Start by fetching the list of recent StagingDeployCash issues, along with the list of open deploy blockers
Expand Down Expand Up @@ -35,14 +36,12 @@ async function run() {
const currentChecklistData = shouldCreateNewDeployChecklist ? {} : GithubUtils.getStagingDeployCashData(mostRecentChecklist);

// Find the list of PRs merged between the current checklist and the previous checklist
// Note that any time we're creating a new checklist we MUST have `NPM_VERSION` passed in as an input
const newTag = newVersion || _.get(currentChecklistData, 'tag');
const mergedPRs = await GitUtils.getPullRequestsMergedBetween(previousChecklistData.tag, newTag);
const mergedPRs = await GitUtils.getPullRequestsMergedBetween(previousChecklistData.tag, newVersionTag);

// Next, we generate the checklist body
let checklistBody = '';
if (shouldCreateNewDeployChecklist) {
checklistBody = await GithubUtils.generateStagingDeployCashBody(newTag, _.map(mergedPRs, GithubUtils.getPullRequestURLFromNumber));
checklistBody = await GithubUtils.generateStagingDeployCashBody(newVersionTag, _.map(mergedPRs, GithubUtils.getPullRequestURLFromNumber));
} else {
// Generate the updated PR list, preserving the previous state of `isVerified` for existing PRs
const PRList = _.reduce(
Expand Down Expand Up @@ -94,9 +93,9 @@ async function run() {
});
}

const didVersionChange = newVersion ? newVersion !== currentChecklistData.tag : false;
const didVersionChange = newVersionTag !== currentChecklistData.tag;
checklistBody = await GithubUtils.generateStagingDeployCashBody(
newTag,
newVersionTag,
_.pluck(PRList, 'url'),
_.pluck(_.where(PRList, {isVerified: true}), 'url'),
_.pluck(deployBlockers, 'url'),
Expand All @@ -118,7 +117,7 @@ async function run() {
if (shouldCreateNewDeployChecklist) {
const {data: newChecklist} = await GithubUtils.octokit.issues.create({
...defaultPayload,
title: `Deploy Checklist: New Expensify ${moment().format('YYYY-MM-DD')}`,
title: `Deploy Checklist: New Expensify ${format(new Date(), CONST.DATE_FORMAT_STRING)}`,
labels: [CONST.LABELS.STAGING_DEPLOY],
assignees: [CONST.APPLAUSE_BOT],
});
Expand Down
Loading

0 comments on commit c2aa07c

Please sign in to comment.