mirror of
https://github.com/trympet/nextcloud-artifacts-action.git
synced 2025-04-24 20:16:08 +02:00
error handling
This commit is contained in:
parent
b52e167ab0
commit
02b35dd9a1
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -383,8 +383,15 @@ class NextcloudArtifact {
|
|||||||
core.info(`Check run HTML: ${resp.data.html_url}`);
|
core.info(`Check run HTML: ${resp.data.html_url}`);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
core.error(error);
|
||||||
|
await this.trySetFailed(createResp.data.id);
|
||||||
|
core.setFailed('Failed to update check');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async trySetFailed(checkId) {
|
||||||
|
try {
|
||||||
await this.octokit.rest.checks.update({
|
await this.octokit.rest.checks.update({
|
||||||
check_run_id: createResp.data.id,
|
check_run_id: checkId,
|
||||||
conclusion: 'failure',
|
conclusion: 'failure',
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
output: {
|
output: {
|
||||||
@ -392,6 +399,11 @@ class NextcloudArtifact {
|
|||||||
},
|
},
|
||||||
...github.context.repo
|
...github.context.repo
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.error(`Failed to update check status to failure`);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logUpload(fileCount, rootDirectory) {
|
logUpload(fileCount, rootDirectory) {
|
||||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@ -95,8 +95,16 @@ export class NextcloudArtifact {
|
|||||||
core.info(`Check run URL: ${resp.data.url}`)
|
core.info(`Check run URL: ${resp.data.url}`)
|
||||||
core.info(`Check run HTML: ${resp.data.html_url}`)
|
core.info(`Check run HTML: ${resp.data.html_url}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
core.error(error)
|
||||||
|
await this.trySetFailed(createResp.data.id)
|
||||||
|
core.setFailed('Failed to update check')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async trySetFailed(checkId: number) {
|
||||||
|
try {
|
||||||
await this.octokit.rest.checks.update({
|
await this.octokit.rest.checks.update({
|
||||||
check_run_id: createResp.data.id,
|
check_run_id: checkId,
|
||||||
conclusion: 'failure',
|
conclusion: 'failure',
|
||||||
status: 'completed',
|
status: 'completed',
|
||||||
output: {
|
output: {
|
||||||
@ -104,6 +112,10 @@ export class NextcloudArtifact {
|
|||||||
},
|
},
|
||||||
...github.context.repo
|
...github.context.repo
|
||||||
})
|
})
|
||||||
|
return true
|
||||||
|
} catch (error) {
|
||||||
|
core.error(`Failed to update check status to failure`)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user