Merge pull request #304 from mikepenz/feature/improved_error_handling

Improved error logs
This commit is contained in:
Mike Penz
2021-05-13 14:56:11 +02:00
committed by GitHub
5 changed files with 18 additions and 4 deletions
Generated Vendored
+6
View File
@@ -974,6 +974,12 @@ class Tags {
return tags[0];
}
catch (error) {
if (tags.length < 1) {
core.warning(`⚠️ Only one tag found for the given repository`);
}
else if (tags.length < 0) {
core.warning(`⚠️ No tag found for the given repository`);
}
return null;
}
});
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -36,7 +36,8 @@ export class Commits {
): Promise<CommitInfo[]> {
// Fetch comparisons recursively until we don't find any commits
// This is because the GitHub API limits the number of commits returned in a single response.
let commits: RestEndpointMethodTypes['repos']['compareCommits']['response']['data']['commits'] = []
let commits: RestEndpointMethodTypes['repos']['compareCommits']['response']['data']['commits'] =
[]
let compareHead = head
// eslint-disable-next-line no-constant-condition
while (true) {
+2 -1
View File
@@ -84,7 +84,8 @@ export class PullRequests {
})
for await (const response of this.octokit.paginate.iterator(options)) {
type PullsListData = RestEndpointMethodTypes['pulls']['list']['response']['data']
type PullsListData =
RestEndpointMethodTypes['pulls']['list']['response']['data']
const prs: PullsListData = response.data as PullsListData
for (const pr of prs.filter(p => !!p.merged_at)) {
+7 -1
View File
@@ -26,7 +26,8 @@ export class Tags {
})
for await (const response of this.octokit.paginate.iterator(options)) {
type TagsListData = RestEndpointMethodTypes['repos']['listTags']['response']['data']
type TagsListData =
RestEndpointMethodTypes['repos']['listTags']['response']['data']
const tags: TagsListData = response.data as TagsListData
for (const tag of tags) {
@@ -80,6 +81,11 @@ export class Tags {
}
return tags[0]
} catch (error) {
if (tags.length < 1) {
core.warning(`⚠️ Only one tag found for the given repository`)
} else if (tags.length < 0) {
core.warning(`⚠️ No tag found for the given repository`)
}
return null
}
}