Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ A sample family of reusable [GitHub Agentic Workflows](https://github.github.com
- [👥 Daily Repo Status](docs/daily-repo-status.md) - Assess repository activity and create status reports
- [👥 Daily Team Status](docs/daily-team-status.md) - Create upbeat daily team activity summaries with productivity insights
- [📋 Daily Plan](docs/daily-plan.md) - Update planning issues for team coordination
- [📊 Artifacts Summary](docs/artifacts-summary.md) - Analyze GitHub Actions artifacts usage and provide storage optimization recommendations

### Dependency Management Workflows

Expand Down
92 changes: 92 additions & 0 deletions docs/artifacts-summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Artifacts Summary

**Status**: Automated workflow analyzer
**Trigger**: Weekly schedule or manual dispatch
**Output**: GitHub Discussion with comprehensive artifacts usage report

## Overview

The Artifacts Summary workflow analyzes GitHub Actions artifacts across all workflows in your repository, providing insights into storage usage, costs, and optimization opportunities. It generates a comprehensive report that helps teams understand which workflows are consuming the most storage and provides actionable recommendations for reducing costs.

## What it does

1. **Scans all workflows** in the repository to identify artifact-generating workflows
2. **Collects artifact data** from recent workflow runs (typically last 30 days)
3. **Calculates statistics** including total count, total size, average size per artifact
4. **Generates a summary table** with workflow-by-workflow breakdown
5. **Provides insights** on storage trends and optimization opportunities
6. **Creates a discussion** with the full report for team review

## When to use this

- **Cost Management**: Monitor GitHub Actions storage costs and identify optimization opportunities
- **Storage Planning**: Understand artifact usage patterns before hitting storage limits
- **Workflow Optimization**: Identify workflows that generate excessive artifacts
- **Compliance**: Track artifact retention and ensure compliance with data policies
- **Trend Analysis**: Compare reports over time to see if optimization efforts are working

## Sample output

The workflow creates a discussion with a table like:

| Workflow Name | Artifacts Count | Total Size | Avg Size | Latest Run | Status |
|---------------|-----------------|------------|----------|------------|--------|
| CI Tests | 45 | 2.3 GB | 52 MB | 2024-01-15 | Active |
| Build | 12 | 456 MB | 38 MB | 2024-01-10 | Active |
| Deploy | 8 | 120 MB | 15 MB | 2024-01-12 | Active |

Along with insights such as:
- Which workflows generate the most artifacts
- Total storage consumption
- Recommendations for optimization (e.g., reducing artifact retention, compressing artifacts)
- Trends compared to previous reports

## What it writes to GitHub

- **Creates one discussion** in the Q&A category with the artifacts usage report
- Updates existing discussion if run multiple times

## What it reads from GitHub

- Workflow configurations and metadata
- Workflow run history (last 30 days typically)
- Artifact metadata (names, sizes, dates)
- Workflow run status and completion information

## How it works

The workflow uses the GitHub Actions API to:
1. List all workflows in the repository
2. Retrieve recent workflow runs for each workflow
3. Fetch artifact information for each run
4. Aggregate statistics and calculate totals
5. Generate human-readable size formats (MB, GB)
6. Create insights and recommendations based on the data

## Configuration

This workflow requires no configuration and works out of the box. It runs weekly by default, but can be triggered manually via workflow dispatch.

After editing run `gh aw compile` to update the workflow and commit all changes to the default branch.

## Permissions required

- `contents: read` - Read repository configuration
- `actions: read` - Access workflow runs and artifacts data

## Why this is useful

**Cost Awareness**: GitHub Actions storage costs can add up quickly, especially for repositories with many workflows generating large artifacts. This workflow provides visibility into storage consumption.

**Optimization**: By identifying which workflows use the most storage, teams can prioritize optimization efforts where they'll have the biggest impact.

**Trend Tracking**: Regular reports allow teams to track whether optimization efforts are working and catch storage growth early.

**Team Communication**: The discussion format makes it easy for teams to review and discuss artifact usage patterns together.

## Example use cases

1. **Pre-budget planning**: Run before quarterly planning to estimate storage costs
2. **Post-migration analysis**: After migrating to GitHub Actions, verify artifact usage is reasonable
3. **Continuous monitoring**: Weekly runs to catch storage spikes early
4. **Optimization campaigns**: Generate baseline report, optimize, then compare to see improvements
82 changes: 82 additions & 0 deletions workflows/artifacts-summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
description: Generates a comprehensive summary of GitHub Actions artifacts usage across all workflows in the repository
on:
workflow_dispatch:
schedule: weekly

permissions:
contents: read
actions: read

network: defaults

safe-outputs:
create-discussion:
title-prefix: "${{ github.workflow }}"
category: "q-a"
max: 1

tools:
github:
toolsets: [actions, repos]

timeout-minutes: 20
---

# Artifacts Summary

Generate a comprehensive summary table of GitHub Actions artifacts usage in the repository ${{ github.repository }}.

## Task Requirements

1. **Analyze all workflows** in the repository to identify which ones generate artifacts
2. **Collect artifact data** for recent workflow runs (last 30 days recommended)
3. **Generate a summary table** with the following columns:
- Workflow Name
- Total Artifacts Count
- Total Size (in MB/GB)
- Average Size per Artifact
- Latest Run Date
- Status (Active/Inactive)

## Analysis Instructions

Please:

1. **List all workflows** in the repository using the GitHub API
2. **For each workflow**, get recent runs and their artifacts
3. **Calculate statistics**:
- Total number of artifacts per workflow
- Total size of all artifacts per workflow
- Average artifact size
- Most recent run date
4. **Create a markdown table** with the summary
5. **Include insights** such as:
- Which workflows generate the most artifacts
- Which workflows use the most storage
- Trends in artifact usage
- Recommendations for optimization

## Output Format

Create a discussion with a markdown table like this:

``````markdown
# Artifacts Usage Report

| Workflow Name | Artifacts Count | Total Size | Avg Size | Latest Run | Status |
|---------------|-----------------|------------|----------|------------|--------|
| workflow-1 | 45 | 2.3 GB | 52 MB | 2024-01-15 | Active |
| workflow-2 | 12 | 456 MB | 38 MB | 2024-01-10 | Active |

## Insights & Recommendations
[Your analysis and recommendations here]
``````

## Important Notes

- Focus on workflows that actually generate artifacts (skip those without any)
- Convert sizes to human-readable formats (MB, GB)
- Consider artifact retention policies in your analysis
- Include both successful and failed runs in the analysis, ignore cancelled runs
- Provide actionable recommendations for reducing storage costs if artifacts are large or numerous
2 changes: 1 addition & 1 deletion workflows/daily-test-improver.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ To decide which phase to perform:
- If running in "repeat" mode, the workflow will automatically run again to proceed to Phase 3
- Humans can review and merge this configuration before continuing

5. Try to run through the steps you worked out manually one by one. If the a step needs updating, then update the branch you created in step 4. Continue through all the steps. If you can't get it to work, then create an issue describing the problem and exit the entire workflow.
5. Try to run through the steps you worked out manually one by one. If a step needs updating, then update the branch you created in step 4. Continue through all the steps. If you can't get it to work, then create an issue describing the problem and exit the entire workflow.

6. Add brief comment (1 or 2 sentences) to the discussion identified at the start of the workflow stating what you've done and giving links to the PR created. If you have taken successful initial coverage numbers for the repository, report the initial coverage numbers appropriately.

Expand Down
10 changes: 5 additions & 5 deletions workflows/pr-fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ You are an AI assistant specialized in fixing pull requests with failing CI chec

4. Formulate a plan to follow the instructions. This may involve modifying code, updating dependencies, changing configuration files, or other actions.

4. Implement the changes needed to follow the instructions.
5. Implement the changes needed to follow the instructions.

5. Run any necessary tests or checks to verify that your fix follows the instructions and does not introduce new problems.
6. Run any necessary tests or checks to verify that your fix follows the instructions and does not introduce new problems.

6. Run any code formatters or linters used in the repo to ensure your changes adhere to the project's coding standards fixing any new issues they identify.
7. Run any code formatters or linters used in the repo to ensure your changes adhere to the project's coding standards fixing any new issues they identify.

7. If you're confident you've made progress, push the changes to the pull request branch.
8. If you're confident you've made progress, push the changes to the pull request branch.

8. Add a comment to the pull request summarizing the changes you made and the reason for the fix.
9. Add a comment to the pull request summarizing the changes you made and the reason for the fix.