From c9bee2316433d746fdc98c6f754f58287e833f74 Mon Sep 17 00:00:00 2001 From: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:02:32 +0700 Subject: [PATCH] fix: web commits check --- .github/workflows/github-no-web-commits.yml | 25 +++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/github-no-web-commits.yml b/.github/workflows/github-no-web-commits.yml index ca4a040f738ea6..37051c31922b8d 100644 --- a/.github/workflows/github-no-web-commits.yml +++ b/.github/workflows/github-no-web-commits.yml @@ -8,7 +8,7 @@ on: # from GitHub UI might be acceptable. Enable this if you want to block # all commits from GitHub UI. # - # - synchronize + - synchronize jobs: has-web-commits: @@ -28,14 +28,21 @@ jobs: } else { const teams = ['ops', 'bots', 'staff', 'dev-team', 'moderators']; for (const team of teams) { - const response = await github.rest.teams.getMembershipForUserInOrg({ - org: context.repo.owner, - team_slug: team, - username: prAuthor - }); - if (response.status == 200) { - isAllowListed = true; - break; + try { + const response = await github.rest.teams.getMembershipForUserInOrg({ + org: context.repo.owner, + team_slug: team, + username: prAuthor + }); + + if (response.status == 200) { + isAllowListed = true; + break; + } + } catch(error) { + if (error.status == 404) { + continue; + } } } }