File tree 3 files changed +19
-2
lines changed
3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 9
9
10
10
# Changelog
11
11
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
+
12
18
## v2.2.1
13
19
14
20
` 2024.02.18 `
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ inputs:
22
22
description : Check whether the user is a bot
23
23
check-contributor :
24
24
description : Check whether the user is contributor
25
+ error-if-missing :
26
+ description : Error if require or check if false
27
+ required : false
25
28
26
29
outputs :
27
30
user-permission :
Original file line number Diff line number Diff line change @@ -35608,30 +35608,38 @@ async function run() {
35608
35608
return contributors;
35609
35609
}
35610
35610
35611
- if (checkBot == 'true') {
35611
+ if (checkBot === 'true') {
35612
35612
const { data } = await octokit.users.getByUsername({
35613
35613
username,
35614
35614
});
35615
35615
if (data.type === 'Bot') {
35616
35616
checkResult = true;
35617
35617
}
35618
- } else if (checkContributor == 'true') {
35618
+ } else if (checkContributor === 'true') {
35619
35619
let contributors = await queryContributors();
35620
35620
contributors = contributors.map(({ login }) => login);
35621
35621
if (contributors.length) {
35622
35622
checkResult = contributors.includes(username);
35623
35623
}
35624
35624
}
35625
35625
35626
+ checkFailed = false;
35626
35627
if (checkBot || checkContributor) {
35627
35628
core.info(`[Action Check] The check result is ${checkResult}.`);
35628
35629
core.setOutput('check-result', checkResult);
35630
+ checkFailed = checkFailed || !checkResult;
35629
35631
}
35630
35632
35631
35633
if (require) {
35632
35634
requireResult = checkPermission(require, permission);
35633
35635
core.info(`[Action Require] The ${username} permission check is ${requireResult}.`);
35634
35636
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.');
35635
35643
}
35636
35644
35637
35645
core.info(THANKS);
You can’t perform that action at this time.
0 commit comments