-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
174 lines (161 loc) · 6.67 KB
/
action.yml
File metadata and controls
174 lines (161 loc) · 6.67 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: "Agent Note"
description: "AI agent session reports and dashboard publishing"
author: "wasabeef"
inputs:
dashboard:
description: "Build and publish Dashboard data instead of updating the PR Report"
required: false
default: "false"
base:
description: "Base branch to compare against (default: PR base)"
required: false
default: ""
pr_output:
description: "PR Report destination: description, comment, or none (default: description)"
required: false
default: ""
prompt_detail:
description: "PR Report prompt detail: compact or full (default: compact)"
required: false
default: "compact"
outputs:
overall_ai_ratio:
description: "PR-wide AI ratio (0-100)"
value: ${{ steps.pr_report.outputs.overall_ai_ratio }}
overall_method:
description: "Attribution method: line, file, mixed, or none"
value: ${{ steps.pr_report.outputs.overall_method }}
tracked_commits:
description: "Number of commits with agent-note data"
value: ${{ steps.pr_report.outputs.tracked_commits }}
total_commits:
description: "Total commits in PR"
value: ${{ steps.pr_report.outputs.total_commits }}
total_prompts:
description: "Total prompts across all commits"
value: ${{ steps.pr_report.outputs.total_prompts }}
json:
description: "Full structured report as JSON"
value: ${{ steps.pr_report.outputs.json }}
markdown:
description: "Rendered markdown report"
value: ${{ steps.pr_report.outputs.markdown }}
should_deploy:
description: "Whether Dashboard data should be published by the caller workflow"
value: ${{ steps.dashboard_publish.outputs.should_deploy }}
runs:
using: "composite"
steps:
- name: Set up Node.js for PR Report
if: inputs.dashboard != 'true'
uses: actions/setup-node@v6
with:
node-version: 24
- name: Run PR Report
if: inputs.dashboard != 'true'
id: pr_report
shell: bash
env:
AGENT_NOTE_ACTION_PATH: ${{ github.action_path }}
INPUT_BASE: ${{ inputs.base }}
INPUT_PR_OUTPUT: ${{ inputs.pr_output }}
INPUT_PROMPT_DETAIL: ${{ inputs.prompt_detail }}
run: node "$AGENT_NOTE_ACTION_PATH/packages/pr-report/dist/index.js"
- name: Detect Dashboard checkout
if: inputs.dashboard == 'true'
id: dashboard_checkout
shell: bash
run: |
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Check out repository
if: inputs.dashboard == 'true' && steps.dashboard_checkout.outputs.exists != 'true'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch Dashboard history
if: inputs.dashboard == 'true' && steps.dashboard_checkout.outputs.exists == 'true'
shell: bash
run: |
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
git fetch --no-tags --prune --unshallow origin '+refs/heads/*:refs/remotes/origin/*' '+refs/tags/*:refs/tags/*'
else
git fetch --no-tags --prune origin '+refs/heads/*:refs/remotes/origin/*' '+refs/tags/*:refs/tags/*'
fi
- name: Set up Node.js for Dashboard
if: inputs.dashboard == 'true'
uses: actions/setup-node@v6
with:
node-version: 22
- name: Resolve Dashboard Pages target
if: inputs.dashboard == 'true'
id: dashboard_paths
shell: bash
env:
DASHBOARD_ACTION_PATH: ${{ github.action_path }}/packages/dashboard
run: npm --prefix "$DASHBOARD_ACTION_PATH" run workflow:resolve-pages-target
- name: Restore Dashboard notes from gh-pages
if: inputs.dashboard == 'true'
shell: bash
env:
DASHBOARD_ACTION_PATH: ${{ github.action_path }}/packages/dashboard
NOTES_DIR: ${{ steps.dashboard_paths.outputs.notes_dir }}
run: npm --prefix "$DASHBOARD_ACTION_PATH" run workflow:restore-notes
- name: Update Dashboard notes from git notes
if: inputs.dashboard == 'true'
id: dashboard_notes
shell: bash
env:
DASHBOARD_ACTION_PATH: ${{ github.action_path }}/packages/dashboard
NOTES_DIR: ${{ steps.dashboard_paths.outputs.notes_dir }}
EVENT_NAME: ${{ github.event_name }}
GH_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
BEFORE_SHA: ${{ github.event.before }}
HEAD_SHA: ${{ github.sha }}
REF_NAME: ${{ github.ref_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
run: npm --prefix "$DASHBOARD_ACTION_PATH" run workflow:sync-notes
- name: Build Dashboard
if: inputs.dashboard == 'true' && steps.dashboard_notes.outputs.should_build == 'true' && steps.dashboard_paths.outputs.can_build == 'true'
shell: bash
env:
DASHBOARD_ACTION_PATH: ${{ github.action_path }}/packages/dashboard
NOTES_DIR: ${{ steps.dashboard_paths.outputs.notes_dir }}
PAGES_DIR: ${{ steps.dashboard_paths.outputs.pages_dir }}
DASHBOARD_PAGES_MODE: ${{ steps.dashboard_paths.outputs.publish_mode }}
PUBLIC_REPO: ${{ github.repository }}
run: npm --prefix "$DASHBOARD_ACTION_PATH" run workflow:build-pages
- name: Resolve Dashboard deploy decision
if: inputs.dashboard == 'true'
id: dashboard_publish
shell: bash
env:
SHOULD_DEPLOY: ${{ steps.dashboard_notes.outputs.should_deploy }}
CAN_BUILD: ${{ steps.dashboard_paths.outputs.can_build }}
run: |
if [ "$SHOULD_DEPLOY" = "true" ] && [ "$CAN_BUILD" = "true" ]; then
echo "should_deploy=true" >> "$GITHUB_OUTPUT"
else
echo "should_deploy=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload Pages artifact
if: inputs.dashboard == 'true' && steps.dashboard_notes.outputs.should_deploy == 'true' && steps.dashboard_paths.outputs.internal_upload == 'true'
uses: actions/upload-pages-artifact@v5
with:
path: ${{ steps.dashboard_paths.outputs.pages_dir }}
- name: Persist Dashboard notes to gh-pages
if: inputs.dashboard == 'true' && steps.dashboard_notes.outputs.should_persist == 'true'
shell: bash
env:
DASHBOARD_ACTION_PATH: ${{ github.action_path }}/packages/dashboard
NOTES_DIR: ${{ steps.dashboard_paths.outputs.notes_dir }}
EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: npm --prefix "$DASHBOARD_ACTION_PATH" run workflow:persist-notes