-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
78 lines (75 loc) · 2.45 KB
/
action.yml
File metadata and controls
78 lines (75 loc) · 2.45 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
name: "a5c reactor"
description: "Run AI agents using gitops principles"
author: "a5c.ai"
branding:
icon: "cpu"
color: "blue"
inputs:
# GitHub Authentication
github_token:
description: "GitHub token for API operations"
required: false
default: "${{ github.token }}"
runner-name:
description: "Runner name"
required: true
events:
description: "Events path"
required: false
default: ".a5c/events/"
outputs:
# Execution Results
success:
description: "Whether all agent executions were successful"
value: ${{ steps.a5c-agent.outputs.success }}
runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
# - name: Authenticate with gh cli
# run: echo ${{ inputs.github_token }} | GH_TOKEN= GITHUB_TOKEN= gh auth login --with-token
# shell: bash
# working-directory: ${{ github.action_path }}
- name: Install a5c
run: npm install -g @a5c-ai/a5c
shell: bash
- name: a5c events reactor
id: a5c-events-reactor
env:
GH_TOKEN: ${{ inputs.github_token }}
GITHUB_TOKEN: ${{ inputs.github_token }}
DISABLE_AUTOUPDATER: 1
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: 1
run: |
set -euo pipefail
A5C_PKG_SPEC="@a5c-ai/a5c"
A5C_CMD="a5c"
echo "A5C_PKG_SPEC=$A5C_PKG_SPEC" >> "$GITHUB_ENV"
echo "A5C_CMD=$A5C_CMD" >> "$GITHUB_ENV"
$A5C_CMD enrich \
--in "$GITHUB_EVENT_PATH" \
--out /tmp/out.enrich.json \
--use-github
INPUT_EVENTS=${{ inputs.events }}
INPUT_EVENTS=$(printf '%s' "$INPUT_EVENTS" | tr -d '\r\n')
# remove the "refs/" prefix from the branch
BRANCH=$(echo -n ${{ github.ref }} | sed 's/refs\///')
# remove the "heads/" prefix from the branch
BRANCH=$(echo -n $BRANCH | sed 's/heads\///')
BRANCH=$(printf '%s' "$BRANCH" | tr -d '\r\n')
export A5C_EVENT_CONFIG_BRANCH="$BRANCH"
echo "A5C_EVENT_CONFIG_BRANCH=$BRANCH" >> "$GITHUB_ENV"
$A5C_CMD reactor \
--in /tmp/out.enrich.json \
--file "$INPUT_EVENTS" \
--out /tmp/out.reactor.json \
--metadata-match runner-name=${{ inputs.runner-name }}
# emit/run the events using the CLI
$A5C_CMD emit \
--in /tmp/out.reactor.json \
--sink github
shell: bash
# working-directory: ${{ github.action_path }}