Skip to content

Commit

Permalink
fix: improve error message for token permissions (#93)
Browse files Browse the repository at this point in the history
Signed-off-by: Tsvetomir Tsonev <[email protected]>
  • Loading branch information
tsvetomir authored Nov 21, 2023
1 parent ae3f783 commit 193dc6c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ async function run() {
akeylessLoginResponse = await auth.akeylessLogin(accessId, accessType, apiUrl);
akeylessToken = akeylessLoginResponse['token'];
} catch (error) {
core.error(`Failed to login to AKeyless: ${JSON.stringify(error)}`);
core.setFailed(`Failed to login to AKeyless: ${JSON.stringify(error)}`);
let message = `Failed to login to AKeyless: ${JSON.stringify(error)}`;
if (message.includes('ACTIONS_ID_TOKEN_REQUEST_URL')) {
message += '\nPlease check the GITHUB_TOKEN token permissions for the job. See:';
message += '\n* https://github.com/LanceMcCarthy/akeyless-action#job-permissions-requirement';
message += '\n* https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions';
}

core.error(message);
core.setFailed(message);
return;
}

Expand Down

0 comments on commit 193dc6c

Please sign in to comment.