Skip to content

Commit

Permalink
read files dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich authored Aug 3, 2024
1 parent c6eb99e commit 066c52f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions log/src/github/artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ArtifactManager {
return null;
}

this.logger.info(`Found ${runs.data.total_count} runs.`)
this.logger.info(`Found ${runs.data.total_count} runs: ${runs.data.workflow_runs.map(w => w.run_started_at)}`)

for (const run of runs.data.workflow_runs) {
this.logger.info(`Searching for artifact in ${run.name}: ${run.id}`);
Expand All @@ -44,7 +44,9 @@ export class ArtifactManager {
run_id: run.id
});

this.logger.info(`Found the following ${artifacts.data.total_count} artifacts: ${artifacts.data.artifacts.map(a => a.name)}`)
this.logger.info(`Found the following ${artifacts.data.total_count} artifacts: ${artifacts.data.artifacts.map(a => a.name)}`);

this.logger.info(`Searching for artifact named ${this.artifactName}`);

const artifact = artifacts.data.artifacts.find(artifact => artifact.name === this.artifactName);

Expand Down
7 changes: 6 additions & 1 deletion log/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Repo } from "./github/types";
import { StatusChecker } from "./status";
import { envsafe, str } from "envsafe";
import { ArtifactManager } from "./github/artifact";
import {readdir} from "fs/promises";

export const env = envsafe({
SOURCES: str(),
Expand Down Expand Up @@ -45,7 +46,11 @@ const run = async () => {
const artifactManager = new ArtifactManager(api, logger, env.ARTIFACT_NAME);

const artifact = await artifactManager.getPreviousArtifact(repo, env.JOB_NAME);
console.log(artifact);
logger.info(`Artifact: ${artifact}`);
if (artifact) {
const files = await readdir(artifact);
logger.info(`Found the following artifacts: ${JSON.stringify(files)}`);
}

const siteResult: Array<[string, boolean]> = [];
for (const [name, url] of sources) {
Expand Down

0 comments on commit 066c52f

Please sign in to comment.