Skip to content

Commit 6b93902

Browse files
committed
Extract Contributor+ membership check into composite action
Adds .github/actions/composite/isContributorPlus so other workflows can reuse the team-membership lookup. claude-review.yml now calls the composite action and reads its IS_CPLUS output instead of inlining the gh api call. Made-with: Cursor
1 parent b31a553 commit 6b93902

2 files changed

Lines changed: 42 additions & 11 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Is Contributor+
2+
description: Check whether a GitHub user is a member of the Expensify/contributor-plus team. Sets IS_CPLUS=true when the user is a member, IS_CPLUS=false otherwise.
3+
4+
inputs:
5+
USERNAME:
6+
description: The GitHub login of the user to check.
7+
required: true
8+
OS_BOTIFY_TOKEN:
9+
description: OSBotify token. Needed to read team memberships (the default GITHUB_TOKEN lacks the read:org scope).
10+
required: true
11+
12+
outputs:
13+
IS_CPLUS:
14+
description: "'true' if the user is a member of Expensify/contributor-plus, 'false' otherwise."
15+
value: ${{ steps.check.outputs.IS_CPLUS }}
16+
17+
runs:
18+
using: composite
19+
steps:
20+
- name: Check Contributor+ membership
21+
id: check
22+
shell: bash
23+
env:
24+
GH_TOKEN: ${{ inputs.OS_BOTIFY_TOKEN }}
25+
USERNAME: ${{ inputs.USERNAME }}
26+
run: |
27+
if gh api "/orgs/Expensify/teams/contributor-plus/memberships/$USERNAME" --silent; then
28+
echo "::notice::✅ $USERNAME is a Contributor+ member"
29+
echo "IS_CPLUS=true" >> "$GITHUB_OUTPUT"
30+
else
31+
echo "::notice::$USERNAME is not a Contributor+ member"
32+
echo "IS_CPLUS=false" >> "$GITHUB_OUTPUT"
33+
fi

.github/workflows/claude-review.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,17 @@ jobs:
2929
outputs:
3030
IS_CPLUS: ${{ steps.check.outputs.IS_CPLUS }}
3131
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
34+
with:
35+
fetch-depth: 1
36+
3237
- name: Check Contributor+ membership
3338
id: check
34-
env:
35-
GH_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
36-
REVIEWER: ${{ github.event.review.user.login }}
37-
run: |
38-
if gh api "/orgs/Expensify/teams/contributor-plus/memberships/$REVIEWER" --silent; then
39-
echo "::notice::✅ Reviewer $REVIEWER is a Contributor+ member"
40-
echo "IS_CPLUS=true" >> "$GITHUB_OUTPUT"
41-
else
42-
echo "::notice::Reviewer $REVIEWER is not a Contributor+ member; skipping Claude review"
43-
echo "IS_CPLUS=false" >> "$GITHUB_OUTPUT"
44-
fi
39+
uses: ./.github/actions/composite/isContributorPlus
40+
with:
41+
USERNAME: ${{ github.event.review.user.login }}
42+
OS_BOTIFY_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
4543

4644
review:
4745
needs: [validate, checkCPlusApproval]

0 commit comments

Comments
 (0)