Skip to content

Commit 23d3853

Browse files
authored
Merge branch 'main' into copilot/fix-daily-issues-report-generator
2 parents e73ef0f + 1cbec99 commit 23d3853

17 files changed

Lines changed: 427 additions & 89 deletions

.github/aw/github-agentic-workflows.md

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/agentics-maintenance.yml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ on:
4949
- 'update'
5050
- 'upgrade'
5151
- 'safe_outputs'
52+
- 'create_labels'
5253
run_url:
5354
description: 'Run URL or run ID to replay safe outputs from (e.g. https://github.com/owner/repo/actions/runs/12345 or 12345). Required when operation is safe_outputs.'
5455
required: false
@@ -106,7 +107,7 @@ jobs:
106107
await main();
107108
108109
run_operation:
109-
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.operation != '' && github.event.inputs.operation != 'safe_outputs' && !github.event.repository.fork }}
110+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.operation != '' && github.event.inputs.operation != 'safe_outputs' && github.event.inputs.operation != 'create_labels' && !github.event.repository.fork }}
110111
runs-on: ubuntu-slim
111112
permissions:
112113
actions: write
@@ -201,6 +202,54 @@ jobs:
201202
const { main } = require('${{ runner.temp }}/gh-aw/actions/apply_safe_outputs_replay.cjs');
202203
await main();
203204
205+
create_labels:
206+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'create_labels' && !github.event.repository.fork }}
207+
runs-on: ubuntu-slim
208+
permissions:
209+
contents: read
210+
issues: write
211+
steps:
212+
- name: Checkout repository
213+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
214+
with:
215+
persist-credentials: false
216+
217+
- name: Setup Scripts
218+
uses: ./actions/setup
219+
with:
220+
destination: ${{ runner.temp }}/gh-aw/actions
221+
222+
- name: Check admin/maintainer permissions
223+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
224+
with:
225+
github-token: ${{ secrets.GITHUB_TOKEN }}
226+
script: |
227+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
228+
setupGlobals(core, github, context, exec, io);
229+
const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
230+
await main();
231+
232+
- name: Setup Go
233+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
234+
with:
235+
go-version-file: go.mod
236+
cache: true
237+
238+
- name: Build gh-aw
239+
run: make build
240+
241+
- name: Create missing labels
242+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
243+
env:
244+
GH_AW_CMD_PREFIX: ./gh-aw
245+
with:
246+
github-token: ${{ secrets.GITHUB_TOKEN }}
247+
script: |
248+
const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
249+
setupGlobals(core, github, context, exec, io);
250+
const { main } = require('${{ runner.temp }}/gh-aw/actions/create_labels.cjs');
251+
await main();
252+
204253
compile-workflows:
205254
if: ${{ !github.event.repository.fork && (github.event_name != 'workflow_dispatch' || github.event.inputs.operation == '') }}
206255
runs-on: ubuntu-slim

.github/workflows/claude-token-optimizer.lock.yml

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/claude-token-optimizer.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ steps:
163163
echo "Found workflow source: $WORKFLOW_MD"
164164
cp "$WORKFLOW_MD" /tmp/token-optimizer-claude/workflow-source.md
165165
else
166-
find .github/workflows -name "*.md" -exec grep -l "^name: $WORKFLOW_NAME" {} \; 2>/dev/null | head -1 | while read -r f; do
167-
echo "Found: $f"
168-
cp "$f" /tmp/token-optimizer-claude/workflow-source.md
169-
done
166+
FOUND_MD=$(find .github/workflows -name "*.md" -exec grep -l "^name: $WORKFLOW_NAME" {} \; 2>/dev/null | head -1 || true)
167+
if [ -n "$FOUND_MD" ]; then
168+
echo "Found: $FOUND_MD"
169+
cp "$FOUND_MD" /tmp/token-optimizer-claude/workflow-source.md
170+
fi
170171
fi
171172
172173
# Extract declared tools from workflow source

.github/workflows/claude-token-usage-analyzer.lock.yml

Lines changed: 16 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/claude-token-usage-analyzer.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,16 @@ steps:
6969
mkdir -p "$ARTIFACT_DIR"
7070
7171
echo "📥 Downloading token-usage.jsonl artifacts..."
72-
jq -r '.[].databaseId' /tmp/token-analyzer-claude/claude-runs.json 2>/dev/null | head -50 | while read -r run_id; do
72+
jq -r '.[0:50][]?.databaseId' /tmp/token-analyzer-claude/claude-runs.json 2>/dev/null > /tmp/token-analyzer-claude/run-ids.txt || true
73+
while read -r run_id; do
7374
run_dir="$ARTIFACT_DIR/$run_id"
7475
mkdir -p "$run_dir"
7576
gh run download "$run_id" \
7677
--repo "$GITHUB_REPOSITORY" \
7778
--name "firewall-audit-logs" \
7879
--dir "$run_dir" \
7980
2>/dev/null || true
80-
done
81+
done < /tmp/token-analyzer-claude/run-ids.txt
8182
8283
# Count how many token-usage.jsonl files we got
8384
JSONL_COUNT=$(find "$ARTIFACT_DIR" -name "token-usage.jsonl" 2>/dev/null | wc -l)
@@ -86,14 +87,15 @@ steps:
8687
# Merge all token-usage.jsonl files annotated with run_id
8788
MERGED_FILE="/tmp/token-analyzer-claude/token-usage-merged.jsonl"
8889
> "$MERGED_FILE"
89-
find "$ARTIFACT_DIR" -name "token-usage.jsonl" | while read -r f; do
90+
find "$ARTIFACT_DIR" -name "token-usage.jsonl" > /tmp/token-analyzer-claude/jsonl-files.txt 2>/dev/null || true
91+
while read -r f; do
9092
run_id=$(echo "$f" | grep -oP '(?<=/artifacts/)\d+(?=/)' || true)
9193
while IFS= read -r line; do
9294
if [ -n "$line" ]; then
9395
echo "${line}" | jq --arg run_id "$run_id" '. + {run_id: $run_id}' >> "$MERGED_FILE" 2>/dev/null || true
9496
fi
9597
done < "$f"
96-
done
98+
done < /tmp/token-analyzer-claude/jsonl-files.txt
9799
98100
RECORD_COUNT=$(wc -l < "$MERGED_FILE" 2>/dev/null || echo 0)
99101
echo "✅ Merged ${RECORD_COUNT} token usage records"

0 commit comments

Comments
 (0)