Skip to content

Commit

Permalink
code structure
Browse files Browse the repository at this point in the history
  • Loading branch information
afujiwara-roblox committed Nov 2, 2023
1 parent fa71755 commit 75f1636
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
9 changes: 4 additions & 5 deletions src/foreman.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {addPath} from "@actions/core";
import {exec} from "@actions/exec";
import {GitHub} from "@actions/github";
import { addPath } from "@actions/core";
import { exec } from "@actions/exec";
import { GitHub } from "@actions/github";
import semver from "semver";
import os from "os";

Expand All @@ -21,7 +21,6 @@ async function getReleases(octokit: GitHub): Promise<GitHubRelease[]> {
});

let releases = response.data as GitHubRelease[];

Check failure on line 23 in src/foreman.ts

View workflow job for this annotation

GitHub Actions / Test allow-external-gitub-org false expect failure (ubuntu-latest)

'releases' is never reassigned. Use 'const' instead

Check failure on line 23 in src/foreman.ts

View workflow job for this annotation

GitHub Actions / Test setup-foreman action (ubuntu-latest)

'releases' is never reassigned. Use 'const' instead

Check failure on line 23 in src/foreman.ts

View workflow job for this annotation

GitHub Actions / Test setup-foreman action with working-directory (ubuntu-latest)

'releases' is never reassigned. Use 'const' instead

Check failure on line 23 in src/foreman.ts

View workflow job for this annotation

GitHub Actions / Test allow-external-gitub-org false expect success (ubuntu-latest)

'releases' is never reassigned. Use 'const' instead
releases = filterValidReleases(releases);
releases.sort((a, b) => -semver.compare(a.tag_name, b.tag_name));

return releases;
Expand Down Expand Up @@ -109,4 +108,4 @@ export default {
filterValidReleases
};

export type {GitHubRelease};
export type { GitHubRelease };
13 changes: 7 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {getInput, debug, addPath, setFailed} from "@actions/core";
import {downloadTool, extractZip} from "@actions/tool-cache";
import {GitHub} from "@actions/github";
import {resolve} from "path";
import {exec} from "@actions/exec";
import { getInput, debug, addPath, setFailed } from "@actions/core";
import { downloadTool, extractZip } from "@actions/tool-cache";
import { GitHub } from "@actions/github";
import { resolve } from "path";
import { exec } from "@actions/exec";
import configFile from "./configFile";
import foreman from "./foreman";

Expand All @@ -17,9 +17,10 @@ async function run(): Promise<void> {

const octokit = new GitHub(githubToken);
const releases = await foreman.getReleases(octokit);
const validReleases = foreman.filterValidReleases(releases)
debug("Choosing release from GitHub API");

const release = foreman.chooseRelease(versionReq, releases);
const release = foreman.chooseRelease(versionReq, validReleases);
if (release == null) {
throw new Error(
`Could not find Foreman release for version ${versionReq}`
Expand Down

0 comments on commit 75f1636

Please sign in to comment.