Skip to content

Commit

Permalink
Merge branch 'Expensify:main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hkopser99 authored Feb 19, 2024
2 parents 4ace68a + 72084da commit 235add7
Show file tree
Hide file tree
Showing 375 changed files with 24,417 additions and 4,028 deletions.
8 changes: 7 additions & 1 deletion .github/actions/composite/buildAndroidE2EAPK/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ inputs:
ARTIFACT_NAME:
description: The name of the workflow artifact where the APK should be uploaded
required: true
ARTIFACT_RETENTION_DAYS:
description: The number of days to retain the artifact
required: false
# Thats github default:
default: "90"
PACKAGE_SCRIPT_NAME:
description: The name of the npm script to run to build the APK
required: true
Expand Down Expand Up @@ -69,7 +74,8 @@ runs:
shell: bash

- name: Upload APK
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: ${{ inputs.ARTIFACT_NAME }}
path: ${{ inputs.APP_OUTPUT_PATH }}
retention-days: ${{ inputs.ARTIFACT_RETENTION_DAYS }}
8 changes: 8 additions & 0 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@ class GithubUtils {
.then((events) => _.filter(events, (event) => event.event === 'closed'))
.then((closedEvents) => lodashGet(_.last(closedEvents), 'actor.login', ''));
}

static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
per_page: 100,
}).then((artifacts) => _.findWhere(artifacts, {name: artefactName}));
}
}

module.exports = GithubUtils;
Expand Down
8 changes: 8 additions & 0 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,14 @@ class GithubUtils {
.then((events) => _.filter(events, (event) => event.event === 'closed'))
.then((closedEvents) => lodashGet(_.last(closedEvents), 'actor.login', ''));
}

static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
per_page: 100,
}).then((artifacts) => _.findWhere(artifacts, {name: artefactName}));
}
}

module.exports = GithubUtils;
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/javascript/bumpVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ const incrementPatch = (major, minor, patch) => {
/**
* Increments a build version
*
* @param {Number} version
* @param {Number} level
* @param {String} version
* @param {String} level
* @returns {String}
*/
const incrementVersion = (version, level) => {
Expand Down
8 changes: 8 additions & 0 deletions .github/actions/javascript/checkDeployBlockers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,14 @@ class GithubUtils {
.then((events) => _.filter(events, (event) => event.event === 'closed'))
.then((closedEvents) => lodashGet(_.last(closedEvents), 'actor.login', ''));
}

static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
per_page: 100,
}).then((artifacts) => _.findWhere(artifacts, {name: artefactName}));
}
}

module.exports = GithubUtils;
Expand Down
12 changes: 10 additions & 2 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,14 @@ class GithubUtils {
.then((events) => _.filter(events, (event) => event.event === 'closed'))
.then((closedEvents) => lodashGet(_.last(closedEvents), 'actor.login', ''));
}

static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
per_page: 100,
}).then((artifacts) => _.findWhere(artifacts, {name: artefactName}));
}
}

module.exports = GithubUtils;
Expand Down Expand Up @@ -978,8 +986,8 @@ const incrementPatch = (major, minor, patch) => {
/**
* Increments a build version
*
* @param {Number} version
* @param {Number} level
* @param {String} version
* @param {String} level
* @returns {String}
*/
const incrementVersion = (version, level) => {
Expand Down
22 changes: 22 additions & 0 deletions .github/actions/javascript/getArtifactInfo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Get artifact info
description: Gets the ID and workflow ID about a specific artifact. By default artifacts are only available in the same workflow. This action can be used to get the information needed to download an artifact from a different workflow.

inputs:
GITHUB_TOKEN:
description: Auth token for New Expensify Github; necessary for accessing Octokit.
required: true
ARTIFACT_NAME:
description: Name of the artifact to get infos about (e.g. to use for downloading that artifact)
required: true

outputs:
ARTIFACT_FOUND:
description: Whether the artifact was found
ARTIFACT_ID:
description: The ID of the artifact
ARTIFACT_WORKFLOW_ID:
description: The ID of the workflow that produced the artifact

runs:
using: "node20"
main: "index.js"
31 changes: 31 additions & 0 deletions .github/actions/javascript/getArtifactInfo/getArtifactInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const _ = require('underscore');
const core = require('@actions/core');
const GithubUtils = require('../../../libs/GithubUtils');

const run = function () {
const artifactName = core.getInput('ARTIFACT_NAME', {required: true});

return GithubUtils.getArtifactByName(artifactName)
.then((artifact) => {
if (_.isUndefined(artifact)) {
console.log(`No artifact found with the name ${artifactName}`);
core.setOutput('ARTIFACT_FOUND', false);
return;
}

console.log('Artifact info', artifact);
core.setOutput('ARTIFACT_FOUND', true);
core.setOutput('ARTIFACT_ID', artifact.id);
core.setOutput('ARTIFACT_WORKFLOW_ID', artifact.workflow_run.id);
})
.catch((error) => {
console.error('A problem occurred while trying to communicate with the GitHub API', error);
core.setFailed(error);
});
};

if (require.main === module) {
run();
}

module.exports = run;
Loading

0 comments on commit 235add7

Please sign in to comment.