Skip to content

Commit 17a47e2

Browse files
iaminaweclaude
andcommitted
Enable automatic workflow approval for Liatrio Labs organization members
This commit updates the Claude Code and OpenCode GPT-5 Codex workflows to automatically allow workflow execution for members of the liatrio-labs GitHub organization without requiring manual approval. Changes: - Added check-org-membership job to both workflows - Checks author_association first (OWNER, MEMBER, COLLABORATOR) - Falls back to checking liatrio-labs organization membership via GitHub API - Main workflow jobs now depend on authorization check passing This ensures that: 1. Existing collaborators continue to work without changes 2. Any member of liatrio-labs organization can trigger workflows 3. Non-members and non-collaborators are still blocked 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
1 parent 9565791 commit 17a47e2

File tree

2 files changed

+100
-26
lines changed

2 files changed

+100
-26
lines changed

.github/workflows/claude.yml

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,70 @@ on:
1111
types: [submitted]
1212

1313
jobs:
14-
claude:
15-
timeout-minutes: 10
16-
concurrency:
17-
group: claude-${{ github.event_name }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}
18-
cancel-in-progress: true
14+
# Check if the user is a member of liatrio-labs organization
15+
check-org-membership:
16+
runs-on: ubuntu-latest
1917
if: |
2018
(
2119
github.event_name == 'issue_comment' &&
22-
contains(github.event.comment.body, '@claude') &&
23-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
20+
contains(github.event.comment.body, '@claude')
2421
) || (
2522
github.event_name == 'pull_request_review_comment' &&
26-
contains(github.event.comment.body, '@claude') &&
27-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
23+
contains(github.event.comment.body, '@claude')
2824
) || (
2925
github.event_name == 'pull_request_review' &&
3026
github.event.review.body != null &&
31-
contains(github.event.review.body, '@claude') &&
32-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association)
27+
contains(github.event.review.body, '@claude')
3328
) || (
3429
github.event_name == 'issues' &&
3530
(
3631
(github.event.issue.body != null && contains(github.event.issue.body, '@claude')) ||
3732
contains(github.event.issue.title, '@claude')
38-
) &&
39-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association)
33+
)
4034
)
35+
outputs:
36+
is-authorized: ${{ steps.check.outputs.authorized }}
37+
steps:
38+
- name: Check authorization
39+
id: check
40+
env:
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
ACTOR="${{ github.actor }}"
44+
45+
# Check if user is a repo collaborator/owner/member first
46+
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
47+
AUTHOR_ASSOC="${{ github.event.comment.author_association }}"
48+
elif [[ "${{ github.event_name }}" == "pull_request_review_comment" ]]; then
49+
AUTHOR_ASSOC="${{ github.event.comment.author_association }}"
50+
elif [[ "${{ github.event_name }}" == "pull_request_review" ]]; then
51+
AUTHOR_ASSOC="${{ github.event.review.author_association }}"
52+
elif [[ "${{ github.event_name }}" == "issues" ]]; then
53+
AUTHOR_ASSOC="${{ github.event.issue.author_association }}"
54+
fi
55+
56+
if [[ "$AUTHOR_ASSOC" == "OWNER" ]] || [[ "$AUTHOR_ASSOC" == "MEMBER" ]] || [[ "$AUTHOR_ASSOC" == "COLLABORATOR" ]]; then
57+
echo "User is authorized via author_association: $AUTHOR_ASSOC"
58+
echo "authorized=true" >> "$GITHUB_OUTPUT"
59+
exit 0
60+
fi
61+
62+
# Check if user is a member of liatrio-labs organization
63+
if gh api "orgs/liatrio-labs/members/$ACTOR" --silent 2>/dev/null; then
64+
echo "User is authorized as liatrio-labs organization member"
65+
echo "authorized=true" >> "$GITHUB_OUTPUT"
66+
else
67+
echo "User is not authorized"
68+
echo "authorized=false" >> "$GITHUB_OUTPUT"
69+
fi
70+
71+
claude:
72+
needs: check-org-membership
73+
if: needs.check-org-membership.outputs.is-authorized == 'true'
74+
timeout-minutes: 10
75+
concurrency:
76+
group: claude-${{ github.event_name }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}
77+
cancel-in-progress: true
4178
runs-on: ubuntu-latest
4279
permissions:
4380
contents: read

.github/workflows/opencode-gpt-5-codex.yml

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,70 @@ on:
1111
types: [submitted]
1212

1313
jobs:
14-
opencode:
15-
timeout-minutes: 30 # to accommodate Codex's ability to run for extended periods
16-
concurrency:
17-
group: opencode-${{ github.event_name }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}
18-
cancel-in-progress: true
14+
# Check if the user is a member of liatrio-labs organization
15+
check-org-membership:
16+
runs-on: ubuntu-latest
1917
if: |
2018
(
2119
github.event_name == 'issue_comment' &&
22-
contains(github.event.comment.body, '/oc-codex') &&
23-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
20+
contains(github.event.comment.body, '/oc-codex')
2421
) || (
2522
github.event_name == 'pull_request_review_comment' &&
26-
contains(github.event.comment.body, '/oc-codex') &&
27-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
23+
contains(github.event.comment.body, '/oc-codex')
2824
) || (
2925
github.event_name == 'pull_request_review' &&
3026
github.event.review.body != null &&
31-
contains(github.event.review.body, '/oc-codex') &&
32-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association)
27+
contains(github.event.review.body, '/oc-codex')
3328
) || (
3429
github.event_name == 'issues' &&
3530
(
3631
(github.event.issue.body != null && contains(github.event.issue.body, '/oc-codex')) ||
3732
contains(github.event.issue.title, '/oc-codex')
38-
) &&
39-
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association)
33+
)
4034
)
35+
outputs:
36+
is-authorized: ${{ steps.check.outputs.authorized }}
37+
steps:
38+
- name: Check authorization
39+
id: check
40+
env:
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
ACTOR="${{ github.actor }}"
44+
45+
# Check if user is a repo collaborator/owner/member first
46+
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
47+
AUTHOR_ASSOC="${{ github.event.comment.author_association }}"
48+
elif [[ "${{ github.event_name }}" == "pull_request_review_comment" ]]; then
49+
AUTHOR_ASSOC="${{ github.event.comment.author_association }}"
50+
elif [[ "${{ github.event_name }}" == "pull_request_review" ]]; then
51+
AUTHOR_ASSOC="${{ github.event.review.author_association }}"
52+
elif [[ "${{ github.event_name }}" == "issues" ]]; then
53+
AUTHOR_ASSOC="${{ github.event.issue.author_association }}"
54+
fi
55+
56+
if [[ "$AUTHOR_ASSOC" == "OWNER" ]] || [[ "$AUTHOR_ASSOC" == "MEMBER" ]] || [[ "$AUTHOR_ASSOC" == "COLLABORATOR" ]]; then
57+
echo "User is authorized via author_association: $AUTHOR_ASSOC"
58+
echo "authorized=true" >> "$GITHUB_OUTPUT"
59+
exit 0
60+
fi
61+
62+
# Check if user is a member of liatrio-labs organization
63+
if gh api "orgs/liatrio-labs/members/$ACTOR" --silent 2>/dev/null; then
64+
echo "User is authorized as liatrio-labs organization member"
65+
echo "authorized=true" >> "$GITHUB_OUTPUT"
66+
else
67+
echo "User is not authorized"
68+
echo "authorized=false" >> "$GITHUB_OUTPUT"
69+
fi
70+
71+
opencode:
72+
needs: check-org-membership
73+
if: needs.check-org-membership.outputs.is-authorized == 'true'
74+
timeout-minutes: 30 # to accommodate Codex's ability to run for extended periods
75+
concurrency:
76+
group: opencode-${{ github.event_name }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}
77+
cancel-in-progress: true
4178
runs-on: ubuntu-latest
4279
permissions:
4380
contents: read

0 commit comments

Comments
 (0)