-
Notifications
You must be signed in to change notification settings - Fork 10
92 lines (85 loc) · 3.53 KB
/
Copy pathopencode-gpt-5-codex.yml
File metadata and controls
92 lines (85 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: opencode-gpt-5-codex
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, edited]
pull_request_review:
types: [submitted]
jobs:
# Check if the user is a member of liatrio-labs organization
check-org-membership:
runs-on: ubuntu-latest
if: |
(
github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '/oc-codex')
) || (
github.event_name == 'pull_request_review_comment' &&
contains(github.event.comment.body, '/oc-codex')
) || (
github.event_name == 'pull_request_review' &&
github.event.review.body != null &&
contains(github.event.review.body, '/oc-codex')
) || (
github.event_name == 'issues' &&
(
(github.event.issue.body != null && contains(github.event.issue.body, '/oc-codex')) ||
contains(github.event.issue.title, '/oc-codex')
)
)
outputs:
is-authorized: ${{ steps.check.outputs.authorized }}
steps:
- name: Check authorization
id: check
env:
GH_TOKEN: ${{ secrets.ORG_MEMBER_CHECK_TOKEN }}
run: |
ACTOR="${{ github.actor }}"
# Check if user is a repo collaborator/owner/member first
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then
AUTHOR_ASSOC="${{ github.event.comment.author_association }}"
elif [[ "${{ github.event_name }}" == "pull_request_review_comment" ]]; then
AUTHOR_ASSOC="${{ github.event.comment.author_association }}"
elif [[ "${{ github.event_name }}" == "pull_request_review" ]]; then
AUTHOR_ASSOC="${{ github.event.review.author_association }}"
elif [[ "${{ github.event_name }}" == "issues" ]]; then
AUTHOR_ASSOC="${{ github.event.issue.author_association }}"
fi
if [[ "$AUTHOR_ASSOC" == "OWNER" ]] || [[ "$AUTHOR_ASSOC" == "MEMBER" ]] || [[ "$AUTHOR_ASSOC" == "COLLABORATOR" ]]; then
echo "User is authorized via author_association: $AUTHOR_ASSOC"
echo "authorized=true" >> "$GITHUB_OUTPUT"
exit 0
fi
# Check if user is a member of liatrio-labs organization
if gh api "orgs/liatrio-labs/members/$ACTOR" --silent 2>/dev/null; then
echo "User is authorized as liatrio-labs organization member"
echo "authorized=true" >> "$GITHUB_OUTPUT"
else
echo "User is not authorized"
echo "authorized=false" >> "$GITHUB_OUTPUT"
fi
opencode:
needs: check-org-membership
if: needs.check-org-membership.outputs.is-authorized == 'true'
timeout-minutes: 30 # to accommodate Codex's ability to run for extended periods
concurrency:
group: opencode-${{ github.event_name }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run opencode
# They are moving fast at https://github.com/sst/opencode/releases, so pinning the version isn't practical yet. We'll keep it at `latest` for now and monitor the changes for a stable version. Latest version as of this writing is `v0.15.3`.
uses: sst/opencode/github@latest
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY_FOR_OPENCODE }}
with:
model: openai/gpt-5-codex