Skip to content

Commit

Permalink
added artigact fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich committed Aug 2, 2024
1 parent 37f61eb commit ba966fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions log/src/github/artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class ArtifactManager {
private readonly logger: ActionLogger,
) { }

async getPreviousArtifact(repo: Repo) {
async getPreviousArtifact(repo: Repo): Promise<string | null> {
const workflows = await this.api.rest.actions.listRepoWorkflows(repo);

const workflow = workflows.data.workflows.find(w => w.path.includes(process.env.WORKFLOW_FILENAME ?? ""));
Expand All @@ -28,7 +28,7 @@ export class ArtifactManager {

if (runs.data.total_count === 0) {
this.logger.error("No runs detected. Is this the first run?");
return;
return null;
}

for (const run of runs.data.workflow_runs) {
Expand Down
3 changes: 3 additions & 0 deletions log/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const run = async () => {
const api = getOctokit(token);
const artifactManager = new ArtifactManager(api, logger);

const artifact = await artifactManager.getPreviousArtifact(repo);
console.log(artifact);

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

0 comments on commit ba966fc

Please # to comment.