Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dacbd committed Jul 22, 2022
1 parent db0a8e8 commit cd85494
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/drivers/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,27 @@ class Github {
}

async workflowCheck() {
try {
// TODO post telemetery merge - only run if in ci?
await this.checkWorkflowForTimeoutMinutes();
} catch (err) {
// noop
}
}

get branch() {
return branchName(GITHUB_HEAD_REF || GITHUB_REF);
}

get userEmail() {
return '[email protected]';
}

get userName() {
return 'GitHub Action';
}

async checkWorkflowForTimeoutMinutes() {
const WARNINGS = [];
const _DIR = '.github/workflows/';
const yaml = require('js-yaml');
Expand All @@ -714,7 +735,6 @@ class Github {
// does job contain timeout?
const timeoutVal = doc.jobs[job]['timeout-minutes'];
if (timeoutVal === undefined) return;

// does job have label runs-on "self-hosted" or "cml"
const runsOn = doc.jobs[job]['runs-on'];
switch (typeof runsOn) {
Expand All @@ -735,15 +755,12 @@ class Github {
);
})
.reduce((pv, v) => pv || v)
) {
)
return;
}
break;
default:
return;
}

console.log('found timeout in job:', job);
// locate timeout for warning
const warning = (function (find) {
const lines = rawStr.split('\n');
Expand All @@ -770,19 +787,6 @@ class Github {
`::warning file=${warning.file},line=${warning.line},title=Possible Unexpected Behavior using "cml runner"::GitHub Actions has updated timeout-minutes if your job is unlikely to run longer than 6hrs then you should remove timeout-minutes, to have cml auto-restart for long training jobs change this value to: 50400 (35d)`
);
}
process.exit();
}

get branch() {
return branchName(GITHUB_HEAD_REF || GITHUB_REF);
}

get userEmail() {
return '[email protected]';
}

get userName() {
return 'GitHub Action';
}
}

Expand Down

1 comment on commit cd85494

@github-actions

This comment was marked as outdated.

Please sign in to comment.