Skip to content

Commit 8086ede

Browse files
1 parent 1fc2b22 commit 8086ede

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/spectral/ipa/metrics/scripts/getShouldRunMetricsRelease.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@ export default async function getShouldRunMetricsRelease({ github, context }) {
3434
page: 1,
3535
});
3636

37-
if (runJobs === undefined || runJobs.length === 0) {
37+
if (!runJobs || !runJobs.data) {
3838
throw Error('listJobsForWorkflowRun response is empty');
3939
}
4040

41-
const previousReleaseJob = runJobs.find((job) => job.name === releaseJobName);
41+
const { jobs } = runJobs.data;
42+
43+
if (!jobs || jobs.length === 0) {
44+
throw Error('Jobs for workflow is empty');
45+
}
46+
47+
const previousReleaseJob = jobs.find((job) => job.name === releaseJobName);
4248

4349
if (!previousReleaseJob) {
4450
throw Error('Could not find previous release job with name' + releaseJobName);

0 commit comments

Comments
 (0)