File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Test Org Membership
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ username :
7
+ description : " GitHub username to check"
8
+ required : true
9
+ type : string
10
+ org :
11
+ description : " GitHub organization name"
12
+ required : true
13
+ type : string
14
+
15
+ jobs :
16
+ test-membership :
17
+ runs-on : ubuntu-latest
18
+
19
+ steps :
20
+ - name : Install GitHub CLI
21
+ run : sudo apt-get install gh -y
22
+
23
+ - name : Check if user is a member of the org
24
+ id : check-membership
25
+ run : |
26
+ USERNAME="${{ inputs.username }}"
27
+ ORG="${{ inputs.org }}"
28
+ STATUS=$(gh api "orgs/$ORG/members/$USERNAME" -q '.login' || true)
29
+
30
+ if [[ "$STATUS" == "$USERNAME" ]]; then
31
+ echo "MEMBER_FOUND=true" >> $GITHUB_ENV
32
+ else
33
+ echo "MEMBER_FOUND=false" >> $GITHUB_ENV
34
+ fi
35
+
36
+ - name : Comment on the check result
37
+ run : |
38
+ if [[ "$MEMBER_FOUND" == "true" ]]; then
39
+ echo "✅ $USERNAME is a member of the $ORG organization."
40
+ else
41
+ echo "❌ $USERNAME is NOT a member of the $ORG organization."
42
+ fi
You can’t perform that action at this time.
0 commit comments