-
Notifications
You must be signed in to change notification settings - Fork 526
2258 lines (2028 loc) · 103 KB
/
Copy pathdaily-file-diet.lock.yml
File metadata and controls
2258 lines (2028 loc) · 103 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# ___ _ _
# / _ \ | | (_)
# | |_| | __ _ ___ _ __ | |_ _ ___
# | _ |/ _` |/ _ \ '_ \| __| |/ __|
# | | | | (_| | __/ | | | |_| | (__
# \_| |_/\__, |\___|_| |_|\__|_|\___|
# __/ |
# _ _ |___/
# | | | | / _| |
# | | | | ___ _ __ _ __| |_| | _____ ____
# | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___|
# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
#
# This file was automatically generated by gh-aw. DO NOT EDIT.
#
# To update this file, edit the corresponding .md file and run:
# gh aw compile
# For more information: https://github.com/githubnext/gh-aw/blob/main/.github/aw/github-agentic-workflows.md
#
# Analyzes the largest Go source file daily and creates an issue to refactor it into smaller files if it exceeds the Go File Size Reduction campaign threshold
#
# Resolved workflow manifest:
# Imports:
# - shared/reporting.md
# - shared/safe-output-app.md
# - shared/trends.md
# - shared/python-dataviz.md
name: "Daily File Diet"
"on":
schedule:
- cron: "0 13 * * 1-5"
# skip-if-match: is:issue is:open in:title "[file-diet]" # Skip-if-match processed as search check in pre-activation job
workflow_dispatch:
permissions:
contents: read
issues: read
pull-requests: read
concurrency:
group: "gh-aw-${{ github.workflow }}"
run-name: "Daily File Diet"
jobs:
activation:
needs: pre_activation
if: needs.pre_activation.outputs.activated == 'true'
runs-on: ubuntu-slim
permissions:
contents: read
outputs:
comment_id: ""
comment_repo: ""
steps:
- name: Checkout actions folder
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
sparse-checkout: |
actions
persist-credentials: false
- name: Setup Scripts
uses: ./actions/setup
with:
destination: /tmp/gh-aw/actions
- name: Check workflow file timestamps
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
GH_AW_WORKFLOW_FILE: "daily-file-diet.lock.yml"
with:
script: |
const { setupGlobals } = require('/tmp/gh-aw/actions/setup_globals.cjs');
setupGlobals(core, github, context, exec, io);
const { main } = require('/tmp/gh-aw/actions/check_workflow_timestamp_api.cjs');
await main();
agent:
needs: activation
runs-on: ubuntu-latest
permissions:
contents: read
issues: read
pull-requests: read
concurrency:
group: "gh-aw-copilot-${{ github.workflow }}"
env:
GH_AW_ASSETS_ALLOWED_EXTS: ".png,.jpg,.jpeg"
GH_AW_ASSETS_BRANCH: "assets/${{ github.workflow }}"
GH_AW_ASSETS_MAX_SIZE_KB: 10240
GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs
GH_AW_SAFE_OUTPUTS: /tmp/gh-aw/safeoutputs/outputs.jsonl
GH_AW_SAFE_OUTPUTS_CONFIG_PATH: /tmp/gh-aw/safeoutputs/config.json
GH_AW_SAFE_OUTPUTS_TOOLS_PATH: /tmp/gh-aw/safeoutputs/tools.json
outputs:
has_patch: ${{ steps.collect_output.outputs.has_patch }}
model: ${{ steps.generate_aw_info.outputs.model }}
output: ${{ steps.collect_output.outputs.output }}
output_types: ${{ steps.collect_output.outputs.output_types }}
steps:
- name: Checkout actions folder
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
sparse-checkout: |
actions
persist-credentials: false
- name: Setup Scripts
uses: ./actions/setup
with:
destination: /tmp/gh-aw/actions
- name: Checkout repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: false
- name: Setup Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
go-version: '1.25'
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.12'
- name: Setup uv
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2
- name: Install Go language service (gopls)
run: go install golang.org/x/tools/gopls@latest
- name: Create gh-aw temp directory
run: bash /tmp/gh-aw/actions/create_gh_aw_tmp_dir.sh
- name: Setup Python environment
run: "# Create working directory for Python scripts\nmkdir -p /tmp/gh-aw/python\nmkdir -p /tmp/gh-aw/python/data\nmkdir -p /tmp/gh-aw/python/charts\nmkdir -p /tmp/gh-aw/python/artifacts\n\necho \"Python environment setup complete\"\necho \"Working directory: /tmp/gh-aw/python\"\necho \"Data directory: /tmp/gh-aw/python/data\"\necho \"Charts directory: /tmp/gh-aw/python/charts\"\necho \"Artifacts directory: /tmp/gh-aw/python/artifacts\"\n"
- name: Install Python scientific libraries
run: "pip install --user --quiet numpy pandas matplotlib seaborn scipy\n\n# Verify installations\npython3 -c \"import numpy; print(f'NumPy {numpy.__version__} installed')\"\npython3 -c \"import pandas; print(f'Pandas {pandas.__version__} installed')\"\npython3 -c \"import matplotlib; print(f'Matplotlib {matplotlib.__version__} installed')\"\npython3 -c \"import seaborn; print(f'Seaborn {seaborn.__version__} installed')\"\npython3 -c \"import scipy; print(f'SciPy {scipy.__version__} installed')\"\n\necho \"All scientific libraries installed successfully\"\n"
- if: always()
name: Upload generated charts
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
if-no-files-found: warn
name: data-charts
path: /tmp/gh-aw/python/charts/*.png
retention-days: 30
- if: always()
name: Upload source files and data
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
if-no-files-found: warn
name: python-source-and-data
path: |
/tmp/gh-aw/python/*.py
/tmp/gh-aw/python/data/*
retention-days: 30
# Cache memory file share configuration from frontmatter processed below
- name: Create cache-memory directory
run: bash /tmp/gh-aw/actions/create_cache_memory_dir.sh
- name: Restore cache memory file share data
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
key: memory-${{ github.workflow }}-${{ github.run_id }}
path: /tmp/gh-aw/cache-memory
restore-keys: |
memory-${{ github.workflow }}-
memory-
# Repo memory git-based storage configuration from frontmatter processed below
- name: Clone repo-memory branch (default)
env:
GH_TOKEN: ${{ github.token }}
BRANCH_NAME: memory/campaigns
TARGET_REPO: ${{ github.repository }}
MEMORY_DIR: /tmp/gh-aw/repo-memory/default
CREATE_ORPHAN: true
run: bash /tmp/gh-aw/actions/clone_repo_memory_branch.sh
- name: Configure Git credentials
env:
REPO_NAME: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Re-authenticate git with GitHub token
SERVER_URL_STRIPPED="${SERVER_URL#https://}"
git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
echo "Git configured with standard GitHub Actions identity"
- name: Checkout PR branch
if: |
github.event.pull_request
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
env:
GH_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
with:
github-token: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { setupGlobals } = require('/tmp/gh-aw/actions/setup_globals.cjs');
setupGlobals(core, github, context, exec, io);
const { main } = require('/tmp/gh-aw/actions/checkout_pr_branch.cjs');
await main();
- name: Validate COPILOT_GITHUB_TOKEN secret
run: /tmp/gh-aw/actions/validate_multi_secret.sh COPILOT_GITHUB_TOKEN GitHub Copilot CLI https://githubnext.github.io/gh-aw/reference/engines/#github-copilot-default
env:
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
- name: Install GitHub Copilot CLI
run: |
# Download official Copilot CLI installer script
curl -fsSL https://raw.githubusercontent.com/github/copilot-cli/main/install.sh -o /tmp/copilot-install.sh
# Execute the installer with the specified version
export VERSION=0.0.374 && sudo bash /tmp/copilot-install.sh
# Cleanup
rm -f /tmp/copilot-install.sh
# Verify installation
copilot --version
- name: Install awf binary
run: |
echo "Installing awf via installer script (requested version: v0.7.0)"
curl -sSL https://raw.githubusercontent.com/githubnext/gh-aw-firewall/main/install.sh | sudo AWF_VERSION=v0.7.0 bash
which awf
awf --version
- name: Determine automatic lockdown mode for GitHub MCP server
id: determine-automatic-lockdown
if: secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN != ''
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const determineAutomaticLockdown = require('/tmp/gh-aw/actions/determine_automatic_lockdown.cjs');
await determineAutomaticLockdown(github, context, core);
- name: Downloading container images
run: bash /tmp/gh-aw/actions/download_docker_images.sh ghcr.io/github/github-mcp-server:v0.26.3
- name: Write Safe Outputs Config
run: |
mkdir -p /tmp/gh-aw/safeoutputs
mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
cat > /tmp/gh-aw/safeoutputs/config.json << 'EOF'
{"create_issue":{"max":1},"missing_tool":{"max":0},"noop":{"max":1},"upload_asset":{"max":0}}
EOF
cat > /tmp/gh-aw/safeoutputs/tools.json << 'EOF'
[
{
"description": "Create a new GitHub issue for tracking bugs, feature requests, or tasks. Use this for actionable work items that need assignment, labeling, and status tracking. For reports, announcements, or status updates that don't require task tracking, use create_discussion instead. CONSTRAINTS: Maximum 1 issue(s) can be created. Title will be prefixed with \"[file-diet] \". Labels [refactoring code-health automated-analysis] will be automatically added.",
"inputSchema": {
"additionalProperties": false,
"properties": {
"body": {
"description": "Detailed issue description in Markdown. Do NOT repeat the title as a heading since it already appears as the issue's h1. Include context, reproduction steps, or acceptance criteria as appropriate.",
"type": "string"
},
"labels": {
"description": "Labels to categorize the issue (e.g., 'bug', 'enhancement'). Labels must exist in the repository.",
"items": {
"type": "string"
},
"type": "array"
},
"parent": {
"description": "Parent issue number for creating sub-issues. This is the numeric ID from the GitHub URL (e.g., 42 in github.com/owner/repo/issues/42). Can also be a temporary_id (e.g., 'aw_abc123def456') from a previously created issue in the same workflow run.",
"type": [
"number",
"string"
]
},
"temporary_id": {
"description": "Unique temporary identifier for referencing this issue before it's created. Format: 'aw_' followed by 12 hex characters (e.g., 'aw_abc123def456'). Use '#aw_ID' in body text to reference other issues by their temporary_id; these are replaced with actual issue numbers after creation.",
"type": "string"
},
"title": {
"description": "Concise issue title summarizing the bug, feature, or task. The title appears as the main heading, so keep it brief and descriptive.",
"type": "string"
}
},
"required": [
"title",
"body"
],
"type": "object"
},
"name": "create_issue"
},
{
"description": "Upload a file as a URL-addressable asset that can be referenced in issues, PRs, or comments. The file is stored on an orphaned git branch and returns a permanent URL. Use this for images, diagrams, or other files that need to be embedded in GitHub content. CONSTRAINTS: Maximum file size: 10240KB. Allowed file extensions: [.png .jpg .jpeg].",
"inputSchema": {
"additionalProperties": false,
"properties": {
"path": {
"description": "Absolute file path to upload (e.g., '/tmp/chart.png'). Must be under the workspace or /tmp directory. By default, only image files (.png, .jpg, .jpeg) are allowed; other file types require workflow configuration.",
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
},
"name": "upload_asset"
},
{
"description": "Report that a tool or capability needed to complete the task is not available. Use this when you cannot accomplish what was requested because the required functionality is missing or access is restricted.",
"inputSchema": {
"additionalProperties": false,
"properties": {
"alternatives": {
"description": "Any workarounds, manual steps, or alternative approaches the user could take (max 256 characters).",
"type": "string"
},
"reason": {
"description": "Explanation of why this tool is needed to complete the task (max 256 characters).",
"type": "string"
},
"tool": {
"description": "Name or description of the missing tool or capability (max 128 characters). Be specific about what functionality is needed.",
"type": "string"
}
},
"required": [
"tool",
"reason"
],
"type": "object"
},
"name": "missing_tool"
},
{
"description": "Log a transparency message when no significant actions are needed. Use this to confirm workflow completion and provide visibility when analysis is complete but no changes or outputs are required (e.g., 'No issues found', 'All checks passed'). This ensures the workflow produces human-visible output even when no other actions are taken.",
"inputSchema": {
"additionalProperties": false,
"properties": {
"message": {
"description": "Status or completion message to log. Should explain what was analyzed and the outcome (e.g., 'Code review complete - no issues found', 'Analysis complete - all tests passing').",
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
},
"name": "noop"
}
]
EOF
cat > /tmp/gh-aw/safeoutputs/validation.json << 'EOF'
{
"create_issue": {
"defaultMax": 1,
"fields": {
"body": {
"required": true,
"type": "string",
"sanitize": true,
"maxLength": 65000
},
"labels": {
"type": "array",
"itemType": "string",
"itemSanitize": true,
"itemMaxLength": 128
},
"parent": {
"issueOrPRNumber": true
},
"repo": {
"type": "string",
"maxLength": 256
},
"temporary_id": {
"type": "string"
},
"title": {
"required": true,
"type": "string",
"sanitize": true,
"maxLength": 128
}
}
},
"missing_tool": {
"defaultMax": 20,
"fields": {
"alternatives": {
"type": "string",
"sanitize": true,
"maxLength": 512
},
"reason": {
"required": true,
"type": "string",
"sanitize": true,
"maxLength": 256
},
"tool": {
"required": true,
"type": "string",
"sanitize": true,
"maxLength": 128
}
}
},
"noop": {
"defaultMax": 1,
"fields": {
"message": {
"required": true,
"type": "string",
"sanitize": true,
"maxLength": 65000
}
}
},
"upload_asset": {
"defaultMax": 10,
"fields": {
"path": {
"required": true,
"type": "string"
}
}
}
}
EOF
- name: Setup MCPs
env:
GH_AW_ASSETS_ALLOWED_EXTS: ${{ env.GH_AW_ASSETS_ALLOWED_EXTS }}
GH_AW_ASSETS_BRANCH: ${{ env.GH_AW_ASSETS_BRANCH }}
GH_AW_ASSETS_MAX_SIZE_KB: ${{ env.GH_AW_ASSETS_MAX_SIZE_KB }}
GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
run: |
mkdir -p /tmp/gh-aw/mcp-config
mkdir -p /home/runner/.copilot
cat > /home/runner/.copilot/mcp-config.json << EOF
{
"mcpServers": {
"github": {
"type": "local",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITHUB_READ_ONLY=1",
"-e",
"GITHUB_LOCKDOWN_MODE=${{ steps.determine-automatic-lockdown.outputs.lockdown == 'true' && '1' || '0' }}",
"-e",
"GITHUB_TOOLSETS=context,repos,issues,pull_requests",
"ghcr.io/github/github-mcp-server:v0.26.3"
],
"tools": ["*"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "\${GITHUB_MCP_SERVER_TOKEN}"
}
},
"safeoutputs": {
"type": "local",
"command": "node",
"args": ["/tmp/gh-aw/safeoutputs/mcp-server.cjs"],
"tools": ["*"],
"env": {
"GH_AW_MCP_LOG_DIR": "\${GH_AW_MCP_LOG_DIR}",
"GH_AW_SAFE_OUTPUTS": "\${GH_AW_SAFE_OUTPUTS}",
"GH_AW_SAFE_OUTPUTS_CONFIG_PATH": "\${GH_AW_SAFE_OUTPUTS_CONFIG_PATH}",
"GH_AW_SAFE_OUTPUTS_TOOLS_PATH": "\${GH_AW_SAFE_OUTPUTS_TOOLS_PATH}",
"GH_AW_ASSETS_BRANCH": "\${GH_AW_ASSETS_BRANCH}",
"GH_AW_ASSETS_MAX_SIZE_KB": "\${GH_AW_ASSETS_MAX_SIZE_KB}",
"GH_AW_ASSETS_ALLOWED_EXTS": "\${GH_AW_ASSETS_ALLOWED_EXTS}",
"GITHUB_REPOSITORY": "\${GITHUB_REPOSITORY}",
"GITHUB_SERVER_URL": "\${GITHUB_SERVER_URL}",
"GITHUB_SHA": "\${GITHUB_SHA}",
"GITHUB_WORKSPACE": "\${GITHUB_WORKSPACE}",
"DEFAULT_BRANCH": "\${DEFAULT_BRANCH}"
}
},
"serena": {
"type": "local",
"command": "uvx",
"args": ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "codex", "--project", "${{ github.workspace }}"],
"tools": ["*"]
}
}
}
EOF
echo "-------START MCP CONFIG-----------"
cat /home/runner/.copilot/mcp-config.json
echo "-------END MCP CONFIG-----------"
echo "-------/home/runner/.copilot-----------"
find /home/runner/.copilot
echo "HOME: $HOME"
echo "GITHUB_COPILOT_CLI_MODE: $GITHUB_COPILOT_CLI_MODE"
- name: Generate agentic run info
id: generate_aw_info
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const fs = require('fs');
const awInfo = {
engine_id: "copilot",
engine_name: "GitHub Copilot CLI",
model: process.env.GH_AW_MODEL_AGENT_COPILOT || "",
version: "",
agent_version: "0.0.374",
workflow_name: "Daily File Diet",
experimental: false,
supports_tools_allowlist: true,
supports_http_transport: true,
run_id: context.runId,
run_number: context.runNumber,
run_attempt: process.env.GITHUB_RUN_ATTEMPT,
repository: context.repo.owner + '/' + context.repo.repo,
ref: context.ref,
sha: context.sha,
actor: context.actor,
event_name: context.eventName,
staged: false,
network_mode: "defaults",
allowed_domains: ["defaults","python"],
firewall_enabled: true,
awf_version: "v0.7.0",
steps: {
firewall: "squid"
},
created_at: new Date().toISOString()
};
// Write to /tmp/gh-aw directory to avoid inclusion in PR
const tmpPath = '/tmp/gh-aw/aw_info.json';
fs.writeFileSync(tmpPath, JSON.stringify(awInfo, null, 2));
console.log('Generated aw_info.json at:', tmpPath);
console.log(JSON.stringify(awInfo, null, 2));
// Set model as output for reuse in other steps/jobs
core.setOutput('model', awInfo.model);
- name: Generate workflow overview
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const { generateWorkflowOverview } = require('/tmp/gh-aw/actions/generate_workflow_overview.cjs');
await generateWorkflowOverview(core);
- name: Create prompt
env:
GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt
GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
GH_AW_GITHUB_REPOSITORY: ${{ github.repository }}
GH_AW_GITHUB_RUN_ID: ${{ github.run_id }}
GH_AW_GITHUB_WORKSPACE: ${{ github.workspace }}
run: |
bash /tmp/gh-aw/actions/create_prompt_first.sh
cat << 'PROMPT_EOF' > "$GH_AW_PROMPT"
## Report Structure
1. **Overview**: 1-2 paragraphs summarizing key findings
2. **Details**: Use `<details><summary><b>Full Report</b></summary>` for expanded content
## Workflow Run References
- Format run IDs as links: `[§12345](https://github.com/owner/repo/actions/runs/12345)`
- Include up to 3 most relevant run URLs at end under `**References:**`
- Do NOT add footer attribution (system adds automatically)
# Trends Visualization Guide
You are an expert at creating compelling trend visualizations that reveal insights from data over time.
## Trending Chart Best Practices
When generating trending charts, focus on:
### 1. **Time Series Excellence**
- Use line charts for continuous trends over time
- Add trend lines or moving averages to highlight patterns
- Include clear date/time labels on the x-axis
- Show confidence intervals or error bands when relevant
### 2. **Comparative Trends**
- Use multi-line charts to compare multiple trends
- Apply distinct colors for each series with a clear legend
- Consider using area charts for stacked trends
- Highlight key inflection points or anomalies
### 3. **Visual Impact**
- Use vibrant, contrasting colors to make trends stand out
- Add annotations for significant events or milestones
- Include grid lines for easier value reading
- Use appropriate scale (linear vs. logarithmic)
### 4. **Contextual Information**
- Show percentage changes or growth rates
- Include baseline comparisons (year-over-year, month-over-month)
- Add summary statistics (min, max, average, median)
- Highlight recent trends vs. historical patterns
## Example Trend Chart Types
### Temporal Trends
```python
# Line chart with multiple trends
fig, ax = plt.subplots(figsize=(12, 7), dpi=300)
for column in data.columns:
ax.plot(data.index, data[column], marker='o', label=column, linewidth=2)
ax.set_title('Trends Over Time', fontsize=16, fontweight='bold')
ax.set_xlabel('Date', fontsize=12)
ax.set_ylabel('Value', fontsize=12)
ax.legend(loc='best')
ax.grid(True, alpha=0.3)
plt.xticks(rotation=45)
```
### Growth Rates
```python
# Bar chart showing period-over-period growth
fig, ax = plt.subplots(figsize=(10, 6), dpi=300)
growth_data.plot(kind='bar', ax=ax, color=sns.color_palette("husl"))
ax.set_title('Growth Rates by Period', fontsize=16, fontweight='bold')
ax.axhline(y=0, color='black', linestyle='-', linewidth=0.8)
ax.set_ylabel('Growth %', fontsize=12)
```
### Moving Averages
```python
# Trend with moving average overlay
fig, ax = plt.subplots(figsize=(12, 7), dpi=300)
ax.plot(dates, values, label='Actual', alpha=0.5, linewidth=1)
ax.plot(dates, moving_avg, label='7-day Moving Average', linewidth=2.5)
ax.fill_between(dates, values, moving_avg, alpha=0.2)
```
## Data Preparation for Trends
### Time-Based Indexing
```python
# Convert to datetime and set as index
data['date'] = pd.to_datetime(data['date'])
data.set_index('date', inplace=True)
data = data.sort_index()
```
### Resampling and Aggregation
```python
# Resample daily data to weekly
weekly_data = data.resample('W').mean()
# Calculate rolling statistics
data['rolling_mean'] = data['value'].rolling(window=7).mean()
data['rolling_std'] = data['value'].rolling(window=7).std()
```
### Growth Calculations
```python
# Calculate percentage change
data['pct_change'] = data['value'].pct_change() * 100
# Calculate year-over-year growth
data['yoy_growth'] = data['value'].pct_change(periods=365) * 100
```
## Color Palettes for Trends
Use these palettes for impactful trend visualizations:
- **Sequential trends**: `sns.color_palette("viridis", n_colors=5)`
- **Diverging trends**: `sns.color_palette("RdYlGn", n_colors=7)`
- **Multiple series**: `sns.color_palette("husl", n_colors=8)`
- **Categorical**: `sns.color_palette("Set2", n_colors=6)`
## Annotation Best Practices
```python
# Annotate key points
max_idx = data['value'].idxmax()
max_val = data['value'].max()
ax.annotate(f'Peak: {max_val:.2f}',
xy=(max_idx, max_val),
xytext=(10, 20),
textcoords='offset points',
arrowprops=dict(arrowstyle='->', color='red'),
fontsize=10,
fontweight='bold')
```
## Styling for Awesome Charts
```python
import matplotlib.pyplot as plt
import seaborn as sns
# Set professional style
sns.set_style("whitegrid")
sns.set_context("notebook", font_scale=1.2)
# Custom color palette
custom_colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#FFA07A", "#98D8C8"]
sns.set_palette(custom_colors)
# Figure with optimal dimensions
fig, ax = plt.subplots(figsize=(14, 8), dpi=300)
# ... your plotting code ...
# Tight layout for clean appearance
plt.tight_layout()
# Save with high quality
plt.savefig('/tmp/gh-aw/python/charts/trend_chart.png',
dpi=300,
bbox_inches='tight',
facecolor='white',
edgecolor='none')
```
## Tips for Trending Charts
1. **Start with the story**: What trend are you trying to show?
2. **Choose the right timeframe**: Match granularity to the pattern
3. **Smooth noise**: Use moving averages for volatile data
4. **Show context**: Include historical baselines or benchmarks
5. **Highlight insights**: Use annotations to draw attention
6. **Test readability**: Ensure labels and legends are clear
7. **Optimize colors**: Use colorblind-friendly palettes
8. **Export high quality**: Always use DPI 300+ for presentations
## Common Trend Patterns to Visualize
- **Seasonal patterns**: Monthly or quarterly cycles
- **Long-term growth**: Exponential or linear trends
- **Volatility changes**: Periods of stability vs. fluctuation
- **Correlations**: How multiple trends relate
- **Anomalies**: Outliers or unusual events
- **Forecasts**: Projected future trends with uncertainty
Remember: The best trending charts tell a clear story, make patterns obvious, and inspire action based on the insights revealed.
# Python Data Visualization Guide
Python scientific libraries have been installed and are ready for use. A temporary folder structure has been created at `/tmp/gh-aw/python/` for organizing scripts, data, and outputs.
## Installed Libraries
- **NumPy**: Array processing and numerical operations
- **Pandas**: Data manipulation and analysis
- **Matplotlib**: Chart generation and plotting
- **Seaborn**: Statistical data visualization
- **SciPy**: Scientific computing utilities
## Directory Structure
```
/tmp/gh-aw/python/
├── data/ # Store all data files here (CSV, JSON, etc.)
├── charts/ # Generated chart images (PNG)
├── artifacts/ # Additional output files
└── *.py # Python scripts
```
## Data Separation Requirement
**CRITICAL**: Data must NEVER be inlined in Python code. Always store data in external files and load using pandas.
### ❌ PROHIBITED - Inline Data
```python
# DO NOT do this
data = [10, 20, 30, 40, 50]
labels = ['A', 'B', 'C', 'D', 'E']
```
### ✅ REQUIRED - External Data Files
```python
# Always load data from external files
import pandas as pd
# Load data from CSV
data = pd.read_csv('/tmp/gh-aw/python/data/data.csv')
# Or from JSON
data = pd.read_json('/tmp/gh-aw/python/data/data.json')
```
## Chart Generation Best Practices
### High-Quality Chart Settings
```python
import matplotlib.pyplot as plt
import seaborn as sns
# Set style for better aesthetics
sns.set_style("whitegrid")
sns.set_palette("husl")
# Create figure with high DPI
fig, ax = plt.subplots(figsize=(10, 6), dpi=300)
# Your plotting code here
# ...
# Save with high quality
plt.savefig('/tmp/gh-aw/python/charts/chart.png',
dpi=300,
bbox_inches='tight',
facecolor='white',
edgecolor='none')
```
### Chart Quality Guidelines
- **DPI**: Use 300 or higher for publication quality
- **Figure Size**: Standard is 10x6 inches (adjustable based on needs)
- **Labels**: Always include clear axis labels and titles
- **Legend**: Add legends when plotting multiple series
- **Grid**: Enable grid lines for easier reading
- **Colors**: Use colorblind-friendly palettes (seaborn defaults are good)
## Including Images in Reports
When creating reports (issues, discussions, etc.), use the `upload asset` tool to make images URL-addressable and include them in markdown:
### Step 1: Generate and Upload Chart
```python
# Generate your chart
plt.savefig('/tmp/gh-aw/python/charts/my_chart.png', dpi=300, bbox_inches='tight')
```
### Step 2: Upload as Asset
Use the `upload asset` tool to upload the chart file. The tool will return a GitHub raw content URL.
### Step 3: Include in Markdown Report
When creating your discussion or issue, include the image using markdown:
```markdown
## Visualization Results

The chart above shows...
```
**Important**: Assets are published to an orphaned git branch and become URL-addressable after workflow completion.
## Cache Memory Integration
The cache memory at `/tmp/gh-aw/cache-memory/` is available for storing reusable code:
**Helper Functions to Cache:**
- Data loading utilities: `data_loader.py`
- Chart styling functions: `chart_utils.py`
- Common data transformations: `transforms.py`
**Check Cache Before Creating:**
```bash
# Check if helper exists in cache
if [ -f /tmp/gh-aw/cache-memory/data_loader.py ]; then
cp /tmp/gh-aw/cache-memory/data_loader.py /tmp/gh-aw/python/
echo "Using cached data_loader.py"
fi
```
**Save to Cache for Future Runs:**
```bash
# Save useful helpers to cache
cp /tmp/gh-aw/python/data_loader.py /tmp/gh-aw/cache-memory/
echo "Saved data_loader.py to cache for future runs"
```
## Complete Example Workflow
```python
#!/usr/bin/env python3
"""
Example data visualization script
Generates a bar chart from external data
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Set style
sns.set_style("whitegrid")
sns.set_palette("husl")
# Load data from external file (NEVER inline)
data = pd.read_csv('/tmp/gh-aw/python/data/data.csv')
# Process data
summary = data.groupby('category')['value'].sum()
# Create chart
fig, ax = plt.subplots(figsize=(10, 6), dpi=300)
summary.plot(kind='bar', ax=ax)
# Customize
ax.set_title('Data Summary by Category', fontsize=16, fontweight='bold')
ax.set_xlabel('Category', fontsize=12)
ax.set_ylabel('Value', fontsize=12)
ax.grid(True, alpha=0.3)
# Save chart
plt.savefig('/tmp/gh-aw/python/charts/chart.png',
dpi=300,
bbox_inches='tight',
facecolor='white')
print("Chart saved to /tmp/gh-aw/python/charts/chart.png")
```
## Error Handling
**Check File Existence:**
```python
import os
data_file = '/tmp/gh-aw/python/data/data.csv'
if not os.path.exists(data_file):
raise FileNotFoundError(f"Data file not found: {data_file}")
```
**Validate Data:**
```python
# Check for required columns
required_cols = ['category', 'value']
missing = set(required_cols) - set(data.columns)
if missing:
raise ValueError(f"Missing columns: {missing}")
```
## Artifact Upload
Charts and source files are automatically uploaded as artifacts:
**Charts Artifact:**
- Name: `data-charts`
- Contents: PNG files from `/tmp/gh-aw/python/charts/`
- Retention: 30 days
**Source and Data Artifact:**
- Name: `python-source-and-data`
- Contents: Python scripts and data files
- Retention: 30 days
Both artifacts are uploaded with `if: always()` condition, ensuring they're available even if the workflow fails.
## Tips for Success
1. **Always Separate Data**: Store data in files, never inline in code
2. **Use Cache Memory**: Store reusable helpers for faster execution
3. **High Quality Charts**: Use DPI 300+ and proper sizing
4. **Clear Documentation**: Add docstrings and comments
5. **Error Handling**: Validate data and check file existence
6. **Type Hints**: Use type annotations for better code quality
7. **Seaborn Defaults**: Leverage seaborn for better aesthetics
8. **Reproducibility**: Set random seeds when needed
## Common Data Sources
Based on common use cases:
**Repository Statistics:**
```python
# Collect via GitHub API, save to data.csv
# Then load and visualize
data = pd.read_csv('/tmp/gh-aw/python/data/repo_stats.csv')
```
**Workflow Metrics:**
```python
# Collect via GitHub Actions API, save to data.json
data = pd.read_json('/tmp/gh-aw/python/data/workflow_metrics.json')
```
**Sample Data Generation:**
```python
# Generate with NumPy, save to file first
import numpy as np
data = np.random.randn(100, 2)
df = pd.DataFrame(data, columns=['x', 'y'])
df.to_csv('/tmp/gh-aw/python/data/sample_data.csv', index=False)
# Then load it back (demonstrating the pattern)
data = pd.read_csv('/tmp/gh-aw/python/data/sample_data.csv')
```
{{#runtime-import? .github/shared-instructions.md}}
# Daily File Diet Agent 🏋️
You are the Daily File Diet Agent - a code health specialist that monitors file sizes and promotes modular, maintainable codebases by identifying oversized files that need refactoring.
## Mission
Analyze the Go codebase daily to identify the largest source file and determine if it requires refactoring. Create an issue only when a file exceeds healthy size thresholds, providing specific guidance for splitting it into smaller, more focused files with comprehensive test coverage.
## Current Context
- **Repository**: __GH_AW_GITHUB_REPOSITORY__
- **Analysis Date**: $(date +%Y-%m-%d)
- **Workspace**: __GH_AW_GITHUB_WORKSPACE__