Skip to content

Commit 53b866b

Browse files
committed
chore: making suggested edits by bshaffer, adding concurrency to combine workflows, adding test condition
1 parent 7724f2f commit 53b866b

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/major-version-approval.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ name: Major Version Approval Check
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, edited]
5+
types: [opened, synchronize, reopened, ready_for_review, edited]
66
branches: ['main']
77
pull_request_review:
88
types: [submitted]
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
12+
cancel-in-progress: true
13+
1014
permissions:
1115
contents: read
1216
pull-requests: read
@@ -15,15 +19,18 @@ jobs:
1519
major-version-approval-check:
1620
name: Major Version Approval Check
1721
runs-on: ubuntu-latest
18-
if: github.event.pull_request.user.login == 'release-please[bot]' && contains(github.event.pull_request.body, 'MAJOR_VERSION_ALLOWED=')
22+
if: contains(github.event.pull_request.body, 'MAJOR_VERSION_ALLOWED=')
23+
# testing
24+
# if: github.event.pull_request.user.login == 'release-please[bot]' && contains(github.event.pull_request.body, 'MAJOR_VERSION_ALLOWED=')
1925
steps:
26+
- uses: actions/checkout@v5
2027
- name: Check for at least 2 approvals from yoshi-php members
2128
env:
22-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
GH_TOKEN: ${{ secrets.SPLIT_TOKEN }}
2330
PR_NUMBER: ${{ github.event.pull_request.number }}
2431
REQUIRED_APPROVALS: 2
2532
run: |
26-
set -eo pipefail
33+
set -e
2734
2835
echo "Fetching approvals for PR #$PR_NUMBER..."
2936
# Get a unique, sorted list of all users who have approved.
@@ -34,14 +41,14 @@ jobs:
3441
fi
3542
3643
echo "Fetching yoshi-php team members..."
37-
team_members=$(gh api --paginate orgs/googleapis/teams/yoshi-php/members --jq '.[].login' | sort -u)
44+
team_members=$(gh api --paginate orgs/googleapis/teams/yoshi-php/members --jq '.[].login')
3845
if [ -z "$team_members" ]; then
3946
echo "Error: Could not fetch any members for the yoshi-php team."
4047
exit 1
4148
fi
4249
4350
# find and count the intersection of the two lists.
44-
count=$(echo "$team_members" | grep -F -x -f <(echo "$approvals") | wc -l)
51+
count=$(echo "$team_members" | sort -u | grep -F -x -f <(echo "$approvals") | wc -l)
4552
4653
echo "Found $count approval(s) from the yoshi-php team."
4754

0 commit comments

Comments
 (0)