diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5938f6e..2ab9ca8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,8 @@ jobs: - name: Set up gh-aw CLI uses: github/gh-aw-actions/setup-cli@f8495a686e66770ae977f82732f34d7340ee42a4 # v0.71.4 with: - gh_token: ${{ secrets.GITHUB_TOKEN }} + version: v0.71.4 + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Compile workflows run: gh aw compile --dir workflows @@ -27,9 +28,17 @@ jobs: - name: Set up gh-aw CLI uses: github/gh-aw-actions/setup-cli@f8495a686e66770ae977f82732f34d7340ee42a4 # v0.71.4 with: - gh_token: ${{ secrets.GITHUB_TOKEN }} + version: v0.71.4 + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Initialize target repository + run: | + TARGET_REPO=$(mktemp -d) + echo "TARGET_REPO=$TARGET_REPO" >> "$GITHUB_ENV" + git init "$TARGET_REPO" - name: Add workflows + working-directory: ${{ env.TARGET_REPO }} run: gh aw add githubnext/agentic-ops/copilot-token-audit githubnext/agentic-ops/copilot-token-optimizer env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/workflows/copilot-token-audit.md b/workflows/copilot-token-audit.md index 22b433c..f5feee8 100644 --- a/workflows/copilot-token-audit.md +++ b/workflows/copilot-token-audit.md @@ -47,12 +47,14 @@ steps: echo "❌ No log data downloaded (exit code $LOGS_EXIT)" echo '{"runs":[],"summary":{}}' > /tmp/gh-aw/token-audit/copilot-logs.json fi +safe-outputs: + create-issue: + close-older-issues: true + expires: 1w + labels: [agentic-workflows, agentic-ops] + title-prefix: "[aw-ops] " timeout-minutes: 25 imports: - - uses: shared/daily-audit-base.md - with: - title-prefix: "[copilot-token-audit] " - - uses: shared/mcp/gh-aw.md - shared/python-dataviz.md --- diff --git a/workflows/shared/daily-audit-base.md b/workflows/shared/daily-audit-base.md deleted file mode 100644 index edf204d..0000000 --- a/workflows/shared/daily-audit-base.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Daily Audit Base - Standard stack for daily audit workflows publishing to GitHub Discussions. -# Bundles: daily-audit-discussion + reporting guidelines + OTLP observability. -# -# Usage: -# imports: -# - uses: shared/daily-audit-base.md -# with: -# title-prefix: "[my-workflow] " -# expires: "1d" # optional, default: 3d - -import-schema: - title-prefix: - type: string - required: true - description: "Title prefix for created discussions, e.g. '[daily-report] '" - expires: - type: string - default: "3d" - description: "How long to keep discussions before expiry" - -imports: - - uses: shared/daily-audit-discussion.md - with: - title-prefix: "${{ github.aw.import-inputs.title-prefix }}" - expires: "${{ github.aw.import-inputs.expires }}" - - shared/reporting.md - - shared/observability-otlp.md ---- diff --git a/workflows/shared/reporting.md b/workflows/shared/reporting.md new file mode 100644 index 0000000..8ab2f6f --- /dev/null +++ b/workflows/shared/reporting.md @@ -0,0 +1,65 @@ +--- +# Reporting Shared Component +# Provides common issue-reporting conventions for agentic workflows. +# +# Usage: +# imports: +# - shared/reporting.md +# +# This import provides: +# - Standard formatting guidelines for issues and discussions +# - Common markdown templates for tables, summaries, and recommendations + +safe-outputs: + create-issue: + close-older-issues: true + expires: 7d +--- + +# Reporting Guidelines + +Use the following conventions when generating issues, discussions, or step summaries. + +## Issue Structure + +Every generated issue should include: + +1. **Executive Summary** — two-to-three sentence overview of findings. +2. **Data Table** — key metrics in a compact markdown table. +3. **Recommendations** — ranked list with estimated impact and concrete action. +4. **Caveats** — sampling limits, missing data, or edge cases that affect confidence. + +Use `
` blocks for long supporting tables to keep the top-level view concise. + +## Markdown Conventions + +- Use `**bold**` for metric names and important values. +- Format large numbers with commas (e.g., `1,234,567`). +- Format costs as `$X.XX` (two decimal places). +- Use emoji sparingly: ✅ success, ⚠️ warning, ❌ failure, 📊 data, 💡 insight. +- Link to relevant runs, PRs, or issues where possible. + +## Table Template + +```markdown +| Metric | Value | Notes | +|---|---|---| +| Total runs | N | Last N days | +| Total tokens | N | Formatted with commas | +| Total cost | $X.XX | USD | +| Avg tokens/run | N | | +``` + +## Recommendations Template + +```markdown +### Recommendations + +1. **[Title]** — estimated savings: ~N tokens/run + - **Action**: ... + - **Evidence**: ... + +2. **[Title]** — estimated savings: ~N tokens/run + - **Action**: ... + - **Evidence**: ... +```