Label member check promises all the way down [ci skip]
github-token: ${{ secrets.GH_TOKEN }}
script: |
console.log(`Label was removed by ${context.payload.sender.login}`);
- let is_authorized = false;
- for (const team of ['staged-recipes']){
+ let memberships = [];
+ for (const team of ['staged-recipes', 'core']) {
const membership = github.rest.teams.getMembershipForUserInOrg({
org: 'conda-forge',
team_slug: team,
username: context.payload.sender.login,
});
- is_authorized = is_authorized || membership.then((result) => {
+ memberships.push(membership.then((result) => {
if (result.status == 200 && result.data.state == 'active') {
console.log('User is authorized');
return true;
} else {
+ console.log('User is nonactive');
return false;
}
}).catch((error) => {
- console.log('There was an error');
- console.log(error);
+ // Non-membership raises an HttpError
return false;
- });
+ }));
+ }
+ return Promise.all(memberships).then((values) => {
+ let is_authorized = false;
+ for (const m of values) {
+ is_authorized = is_authorized || m;
}
return is_authorized;
+ });
- name: add-labels
if: >
(steps.check_team_review.outputs.result == 'true')
