Skip to content

Commit

Permalink
remove type castings related to GitHubUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
JKobrynski committed Mar 27, 2024
1 parent 3d32646 commit 81e823f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
10 changes: 3 additions & 7 deletions .github/actions/javascript/getArtifactInfo/getArtifactInfo.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import * as core from '@actions/core';
import type {components as OctokitComponents} from '@octokit/openapi-types/types';
import GithubUtils from '../../../libs/GithubUtils';

type OctokitArtifact = OctokitComponents['schemas']['artifact'];
import GithubUtils from '@github/libs/GithubUtils';

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

// TODO: remove type casting once GithubUtils (https://github.com/Expensify/App/pull/38280) is migrated to TypeScript
return GithubUtils.getArtifactByName(artifactName)
.then((artifact: OctokitArtifact) => {
.then((artifact) => {
if (artifact === undefined) {
console.log(`No artifact found with the name ${artifactName}`);
core.setOutput('ARTIFACT_FOUND', false);
Expand All @@ -24,7 +20,7 @@ const run = function (): Promise<void> {
.catch((error: Error) => {
console.error('A problem occurred while trying to communicate with the GitHub API', error);
core.setFailed(error);
}) as Promise<void>;
});
};

if (require.main === module) {
Expand Down
1 change: 0 additions & 1 deletion .github/actions/javascript/getArtifactInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11481,7 +11481,6 @@ const core = __importStar(__nccwpck_require__(2186));
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
const run = function () {
const artifactName = core.getInput('ARTIFACT_NAME', { required: true });
// TODO: remove type casting once GithubUtils (https://github.com/Expensify/App/pull/38280) is migrated to TypeScript
return GithubUtils_1.default.getArtifactByName(artifactName)
.then((artifact) => {
if (artifact === undefined) {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/markPullRequestsAsDeployedTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* @jest-environment node
*/
import type {InternalOctokit} from '../../.github/libs/GithubUtils';
import GithubUtils from '../../.github/libs/GithubUtils';
import GitUtils from '../../.github/libs/GitUtils';

Expand Down Expand Up @@ -129,8 +130,7 @@ beforeAll(() => {
paginate: jest.fn().mockImplementation(<T>(objectMethod: () => Promise<ObjectMethodData<T>>) => objectMethod().then(({data}) => data)),
};

// @ts-expect-error TODO: Remove this once GithubUtils (https://github.com/Expensify/App/issues/25382) is migrated to TypeScript.
GithubUtils.internalOctokit = moctokit;
GithubUtils.internalOctokit = moctokit as unknown as InternalOctokit;

// Mock GitUtils
GitUtils.getPullRequestsMergedBetween = jest.fn();
Expand Down

0 comments on commit 81e823f

Please sign in to comment.