-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (53 loc) · 2.01 KB
/
Copy pathambient.yml
File metadata and controls
59 lines (53 loc) · 2.01 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
name: Ambient
on:
issue_comment:
types: [created]
permissions:
contents: read
issues: write
jobs:
ambient:
if: >-
startsWith(github.event.comment.body, '@ambient') &&
contains(fromJSON('["OWNER","MEMBER"]'), github.event.comment.author_association)
runs-on: ubuntu-latest
steps:
- uses: ambient-code/ambient-action@v0.0.2
id: session
with:
api-url: ${{ secrets.AMBIENT_API_URL }}
api-token: ${{ secrets.AMBIENT_BOT_TOKEN }}
project: ambient-team
prompt: ${{ github.event.comment.body }}
display-name: "Issue #${{ github.event.issue.number }}"
repos: '[{"url": "https://github.com/${{ github.repository }}", "branch": "ambient/issue-${{ github.event.issue.number }}", "autoPush": true}]'
labels: '{"source": "github-issue", "issue": "${{ github.event.issue.number }}"}'
wait: 'true'
timeout: '300'
- name: Post result to issue
if: always()
env:
GH_TOKEN: ${{ github.token }}
SESSION_NAME: ${{ steps.session.outputs.session-name }}
SESSION_PHASE: ${{ steps.session.outputs.session-phase }}
SESSION_RESULT: ${{ steps.session.outputs.session-result }}
run: |
if [ "$SESSION_PHASE" = "Completed" ]; then
EMOJI="✅"
elif [ -z "$SESSION_PHASE" ]; then
EMOJI="❌"
SESSION_PHASE="CreateFailed"
else
EMOJI="⚠️"
fi
{
printf '%s\n' "${EMOJI} **Ambient session ${SESSION_PHASE}** (\`${SESSION_NAME}\`)"
if [ -n "$SESSION_RESULT" ]; then
printf '\n<details>\n<summary>Session output</summary>\n\n'
printf '%s\n' "$SESSION_RESULT"
printf '\n</details>\n'
fi
} > "$RUNNER_TEMP/comment-body.md"
gh issue comment "${{ github.event.issue.number }}" \
--repo "${{ github.repository }}" \
--body-file "$RUNNER_TEMP/comment-body.md"