File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 99
1010# Changelog
1111
12+ ## v2.3.0
13+
14+ ` 2025.01.07 `
15+
16+ - 🚀 feat: support ` error-if-missing ` . [ #14 ] ( https://github.com/actions-cool/check-user-permission/pull/14 ) [ @nicgrayson ] ( https://github.com/nicgrayson ) [ @LukeLalor ] ( https://github.com/LukeLalor )
17+
1218## v2.2.1
1319
1420` 2024.02.18 `
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ inputs:
2222 description : Check whether the user is a bot
2323 check-contributor :
2424 description : Check whether the user is contributor
25+ error-if-missing :
26+ description : Error if require or check if false
27+ required : false
2528
2629outputs :
2730 user-permission :
Original file line number Diff line number Diff line change @@ -35608,30 +35608,38 @@ async function run() {
3560835608 return contributors;
3560935609 }
3561035610
35611- if (checkBot == 'true') {
35611+ if (checkBot === 'true') {
3561235612 const { data } = await octokit.users.getByUsername({
3561335613 username,
3561435614 });
3561535615 if (data.type === 'Bot') {
3561635616 checkResult = true;
3561735617 }
35618- } else if (checkContributor == 'true') {
35618+ } else if (checkContributor === 'true') {
3561935619 let contributors = await queryContributors();
3562035620 contributors = contributors.map(({ login }) => login);
3562135621 if (contributors.length) {
3562235622 checkResult = contributors.includes(username);
3562335623 }
3562435624 }
3562535625
35626+ checkFailed = false;
3562635627 if (checkBot || checkContributor) {
3562735628 core.info(`[Action Check] The check result is ${checkResult}.`);
3562835629 core.setOutput('check-result', checkResult);
35630+ checkFailed = checkFailed || !checkResult;
3562935631 }
3563035632
3563135633 if (require) {
3563235634 requireResult = checkPermission(require, permission);
3563335635 core.info(`[Action Require] The ${username} permission check is ${requireResult}.`);
3563435636 core.setOutput('require-result', requireResult);
35637+ checkFailed = checkFailed || !requireResult;
35638+ }
35639+
35640+ const errorIfMissing = core.getInput('error-if-missing');
35641+ if (checkFailed && errorIfMissing === 'true') {
35642+ core.setFailed('The required check failed.');
3563535643 }
3563635644
3563735645 core.info(THANKS);
You can’t perform that action at this time.
0 commit comments