mirror of
https://github.com/Z3Prover/z3
synced 2026-04-26 05:43:33 +00:00
Merge pull request #8513 from Z3Prover/copilot/update-code-simplifier-to-github-discussion
Change code-simplifier to create discussions with git diffs instead of PRs
This commit is contained in:
commit
7c66140cc8
2 changed files with 132 additions and 194 deletions
226
.github/workflows/code-simplifier.lock.yml
generated
vendored
226
.github/workflows/code-simplifier.lock.yml
generated
vendored
|
|
@ -13,7 +13,7 @@
|
||||||
# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
|
# \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
|
||||||
# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
|
# \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
|
||||||
#
|
#
|
||||||
# This file was automatically generated by gh-aw (v0.42.2). DO NOT EDIT.
|
# This file was automatically generated by gh-aw (v0.42.6). DO NOT EDIT.
|
||||||
#
|
#
|
||||||
# To update this file, edit github/gh-aw/.github/workflows/code-simplifier.md@76d37d925abd44fee97379206f105b74b91a285b and run:
|
# To update this file, edit github/gh-aw/.github/workflows/code-simplifier.md@76d37d925abd44fee97379206f105b74b91a285b and run:
|
||||||
# gh aw compile
|
# gh aw compile
|
||||||
|
|
@ -23,16 +23,12 @@
|
||||||
#
|
#
|
||||||
# Source: github/gh-aw/.github/workflows/code-simplifier.md@76d37d925abd44fee97379206f105b74b91a285b
|
# Source: github/gh-aw/.github/workflows/code-simplifier.md@76d37d925abd44fee97379206f105b74b91a285b
|
||||||
#
|
#
|
||||||
# Resolved workflow manifest:
|
# frontmatter-hash: 524bb76c31408e5f0f29cecabd86aedd3f216a21307f8504a8a48d99e7824284
|
||||||
# Imports:
|
|
||||||
# - github/gh-aw/.github/workflows/shared/reporting.md@76d37d925abd44fee97379206f105b74b91a285b
|
|
||||||
#
|
|
||||||
# frontmatter-hash: 4a54252a1b9a2cfb23055bf99c787be656702eb2a1676bebd4f3868b623ee0ca
|
|
||||||
|
|
||||||
name: "Code Simplifier"
|
name: "Code Simplifier"
|
||||||
"on":
|
"on":
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "27 13 * * *"
|
- cron: "7 16 * * *"
|
||||||
# Friendly format: daily (scattered)
|
# Friendly format: daily (scattered)
|
||||||
# skip-if-match: is:pr is:open in:title "[code-simplifier]" # Skip-if-match processed as search check in pre-activation job
|
# skip-if-match: is:pr is:open in:title "[code-simplifier]" # Skip-if-match processed as search check in pre-activation job
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
@ -56,7 +52,7 @@ jobs:
|
||||||
comment_repo: ""
|
comment_repo: ""
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
uses: github/gh-aw/actions/setup@c6d30bee9ffff7c09b8c491d5fd975284c538360 # v0.42.2
|
uses: github/gh-aw/actions/setup@v0.42.6
|
||||||
with:
|
with:
|
||||||
destination: /opt/gh-aw/actions
|
destination: /opt/gh-aw/actions
|
||||||
- name: Check workflow file timestamps
|
- name: Check workflow file timestamps
|
||||||
|
|
@ -75,8 +71,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
discussions: read
|
||||||
issues: read
|
issues: read
|
||||||
pull-requests: read
|
pull-requests: read
|
||||||
|
concurrency:
|
||||||
|
group: "gh-aw-copilot-${{ github.workflow }}"
|
||||||
env:
|
env:
|
||||||
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||||
GH_AW_ASSETS_ALLOWED_EXTS: ""
|
GH_AW_ASSETS_ALLOWED_EXTS: ""
|
||||||
|
|
@ -95,12 +94,16 @@ jobs:
|
||||||
secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
|
secret_verification_result: ${{ steps.validate-secret.outputs.verification_result }}
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
uses: github/gh-aw/actions/setup@c6d30bee9ffff7c09b8c491d5fd975284c538360 # v0.42.2
|
uses: github/gh-aw/actions/setup@v0.42.6
|
||||||
with:
|
with:
|
||||||
destination: /opt/gh-aw/actions
|
destination: /opt/gh-aw/actions
|
||||||
- name: Checkout repository
|
- name: Checkout .github and .agents folders
|
||||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
||||||
with:
|
with:
|
||||||
|
sparse-checkout: |
|
||||||
|
.github
|
||||||
|
.agents
|
||||||
|
depth: 1
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Create gh-aw temp directory
|
- name: Create gh-aw temp directory
|
||||||
run: bash /opt/gh-aw/actions/create_gh_aw_tmp_dir.sh
|
run: bash /opt/gh-aw/actions/create_gh_aw_tmp_dir.sh
|
||||||
|
|
@ -135,9 +138,9 @@ jobs:
|
||||||
env:
|
env:
|
||||||
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: /opt/gh-aw/actions/install_copilot_cli.sh 0.0.402
|
run: /opt/gh-aw/actions/install_copilot_cli.sh 0.0.403
|
||||||
- name: Install awf binary
|
- name: Install awf binary
|
||||||
run: bash /opt/gh-aw/actions/install_awf_binary.sh v0.13.4
|
run: bash /opt/gh-aw/actions/install_awf_binary.sh v0.13.7
|
||||||
- name: Determine automatic lockdown mode for GitHub MCP server
|
- name: Determine automatic lockdown mode for GitHub MCP server
|
||||||
id: determine-automatic-lockdown
|
id: determine-automatic-lockdown
|
||||||
env:
|
env:
|
||||||
|
|
@ -149,39 +152,32 @@ jobs:
|
||||||
const determineAutomaticLockdown = require('/opt/gh-aw/actions/determine_automatic_lockdown.cjs');
|
const determineAutomaticLockdown = require('/opt/gh-aw/actions/determine_automatic_lockdown.cjs');
|
||||||
await determineAutomaticLockdown(github, context, core);
|
await determineAutomaticLockdown(github, context, core);
|
||||||
- name: Download container images
|
- name: Download container images
|
||||||
run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent-act:0.13.4 ghcr.io/github/gh-aw-firewall/squid:0.13.4 ghcr.io/github/gh-aw-mcpg:v0.0.98 ghcr.io/github/github-mcp-server:v0.30.3 node:lts-alpine
|
run: bash /opt/gh-aw/actions/download_docker_images.sh ghcr.io/github/gh-aw-firewall/agent:0.13.7 ghcr.io/github/gh-aw-firewall/squid:0.13.7 ghcr.io/github/gh-aw-mcpg:v0.0.103 ghcr.io/github/github-mcp-server:v0.30.3 node:lts-alpine
|
||||||
- name: Write Safe Outputs Config
|
- name: Write Safe Outputs Config
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /opt/gh-aw/safeoutputs
|
mkdir -p /opt/gh-aw/safeoutputs
|
||||||
mkdir -p /tmp/gh-aw/safeoutputs
|
mkdir -p /tmp/gh-aw/safeoutputs
|
||||||
mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
|
mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs
|
||||||
cat > /opt/gh-aw/safeoutputs/config.json << 'EOF'
|
cat > /opt/gh-aw/safeoutputs/config.json << 'EOF'
|
||||||
{"create_pull_request":{"expires":168},"missing_data":{},"missing_tool":{},"noop":{"max":1}}
|
{"create_discussion":{"expires":168,"max":1},"missing_data":{},"missing_tool":{},"noop":{"max":1}}
|
||||||
EOF
|
EOF
|
||||||
cat > /opt/gh-aw/safeoutputs/tools.json << 'EOF'
|
cat > /opt/gh-aw/safeoutputs/tools.json << 'EOF'
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"description": "Create a new GitHub pull request to propose code changes. Use this after making file edits to submit them for review and merging. The PR will be created from the current branch with your committed changes. For code review comments on an existing PR, use create_pull_request_review_comment instead. CONSTRAINTS: Maximum 1 pull request(s) can be created. Title will be prefixed with \"[code-simplifier] \". Labels [refactoring code-quality automation] will be automatically added. Reviewers [copilot] will be assigned.",
|
"description": "Create a GitHub discussion for announcements, Q\u0026A, reports, status updates, or community conversations. Use this for content that benefits from threaded replies, doesn't require task tracking, or serves as documentation. For actionable work items that need assignment and status tracking, use create_issue instead. CONSTRAINTS: Maximum 1 discussion(s) can be created. Title will be prefixed with \"[code-simplifier] \". Discussions will be created in category \"general\".",
|
||||||
"inputSchema": {
|
"inputSchema": {
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"body": {
|
"body": {
|
||||||
"description": "Detailed PR description in Markdown. Include what changes were made, why, testing notes, and any breaking changes. Do NOT repeat the title as a heading.",
|
"description": "Discussion content in Markdown. Do NOT repeat the title as a heading since it already appears as the discussion's h1. Include all relevant context, findings, or questions.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"branch": {
|
"category": {
|
||||||
"description": "Source branch name containing the changes. If omitted, uses the current working branch.",
|
"description": "Discussion category by name (e.g., 'General'), slug (e.g., 'general'), or ID. If omitted, uses the first available category. Category must exist in the repository.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"labels": {
|
|
||||||
"description": "Labels to categorize the PR (e.g., 'enhancement', 'bugfix'). Labels must exist in the repository.",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"type": "array"
|
|
||||||
},
|
|
||||||
"title": {
|
"title": {
|
||||||
"description": "Concise PR title describing the changes. Follow repository conventions (e.g., conventional commits). The title appears as the main heading.",
|
"description": "Concise discussion title summarizing the topic. The title appears as the main heading, so keep it brief and descriptive.",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -191,7 +187,7 @@ jobs:
|
||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"name": "create_pull_request"
|
"name": "create_discussion"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Report that a tool or capability needed to complete the task is not available, or share any information you deem important about missing functionality or limitations. Use this when you cannot accomplish what was requested because the required functionality is missing or access is restricted.",
|
"description": "Report that a tool or capability needed to complete the task is not available, or share any information you deem important about missing functionality or limitations. Use this when you cannot accomplish what was requested because the required functionality is missing or access is restricted.",
|
||||||
|
|
@ -266,7 +262,7 @@ jobs:
|
||||||
EOF
|
EOF
|
||||||
cat > /opt/gh-aw/safeoutputs/validation.json << 'EOF'
|
cat > /opt/gh-aw/safeoutputs/validation.json << 'EOF'
|
||||||
{
|
{
|
||||||
"create_pull_request": {
|
"create_discussion": {
|
||||||
"defaultMax": 1,
|
"defaultMax": 1,
|
||||||
"fields": {
|
"fields": {
|
||||||
"body": {
|
"body": {
|
||||||
|
|
@ -275,17 +271,14 @@ jobs:
|
||||||
"sanitize": true,
|
"sanitize": true,
|
||||||
"maxLength": 65000
|
"maxLength": 65000
|
||||||
},
|
},
|
||||||
"branch": {
|
"category": {
|
||||||
"required": true,
|
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"sanitize": true,
|
"sanitize": true,
|
||||||
"maxLength": 256
|
"maxLength": 128
|
||||||
},
|
},
|
||||||
"labels": {
|
"repo": {
|
||||||
"type": "array",
|
"type": "string",
|
||||||
"itemType": "string",
|
"maxLength": 256
|
||||||
"itemSanitize": true,
|
|
||||||
"itemMaxLength": 128
|
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"required": true,
|
"required": true,
|
||||||
|
|
@ -386,12 +379,14 @@ jobs:
|
||||||
MCP_GATEWAY_API_KEY=""
|
MCP_GATEWAY_API_KEY=""
|
||||||
MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
|
MCP_GATEWAY_API_KEY=$(openssl rand -base64 45 | tr -d '/+=')
|
||||||
export MCP_GATEWAY_API_KEY
|
export MCP_GATEWAY_API_KEY
|
||||||
|
export MCP_GATEWAY_PAYLOAD_DIR="/tmp/gh-aw/mcp-payloads"
|
||||||
|
mkdir -p "${MCP_GATEWAY_PAYLOAD_DIR}"
|
||||||
export DEBUG="*"
|
export DEBUG="*"
|
||||||
|
|
||||||
# Register API key as secret to mask it from logs
|
# Register API key as secret to mask it from logs
|
||||||
echo "::add-mask::${MCP_GATEWAY_API_KEY}"
|
echo "::add-mask::${MCP_GATEWAY_API_KEY}"
|
||||||
export GH_AW_ENGINE="copilot"
|
export GH_AW_ENGINE="copilot"
|
||||||
export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_LOCKDOWN -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.0.98'
|
export MCP_GATEWAY_DOCKER_COMMAND='docker run -i --rm --network host -v /var/run/docker.sock:/var/run/docker.sock -e MCP_GATEWAY_PORT -e MCP_GATEWAY_DOMAIN -e MCP_GATEWAY_API_KEY -e MCP_GATEWAY_PAYLOAD_DIR -e DEBUG -e MCP_GATEWAY_LOG_DIR -e GH_AW_MCP_LOG_DIR -e GH_AW_SAFE_OUTPUTS -e GH_AW_SAFE_OUTPUTS_CONFIG_PATH -e GH_AW_SAFE_OUTPUTS_TOOLS_PATH -e GH_AW_ASSETS_BRANCH -e GH_AW_ASSETS_MAX_SIZE_KB -e GH_AW_ASSETS_ALLOWED_EXTS -e DEFAULT_BRANCH -e GITHUB_MCP_SERVER_TOKEN -e GITHUB_MCP_LOCKDOWN -e GITHUB_REPOSITORY -e GITHUB_SERVER_URL -e GITHUB_SHA -e GITHUB_WORKSPACE -e GITHUB_TOKEN -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RUN_ATTEMPT -e GITHUB_JOB -e GITHUB_ACTION -e GITHUB_EVENT_NAME -e GITHUB_EVENT_PATH -e GITHUB_ACTOR -e GITHUB_ACTOR_ID -e GITHUB_TRIGGERING_ACTOR -e GITHUB_WORKFLOW -e GITHUB_WORKFLOW_REF -e GITHUB_WORKFLOW_SHA -e GITHUB_REF -e GITHUB_REF_NAME -e GITHUB_REF_TYPE -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GH_AW_SAFE_OUTPUTS_PORT -e GH_AW_SAFE_OUTPUTS_API_KEY -v /tmp/gh-aw/mcp-payloads:/tmp/gh-aw/mcp-payloads:rw -v /opt:/opt:ro -v /tmp:/tmp:rw -v '"${GITHUB_WORKSPACE}"':'"${GITHUB_WORKSPACE}"':rw ghcr.io/github/gh-aw-mcpg:v0.0.103'
|
||||||
|
|
||||||
mkdir -p /home/runner/.copilot
|
mkdir -p /home/runner/.copilot
|
||||||
cat << MCPCONFIG_EOF | bash /opt/gh-aw/actions/start_mcp_gateway.sh
|
cat << MCPCONFIG_EOF | bash /opt/gh-aw/actions/start_mcp_gateway.sh
|
||||||
|
|
@ -418,7 +413,8 @@ jobs:
|
||||||
"gateway": {
|
"gateway": {
|
||||||
"port": $MCP_GATEWAY_PORT,
|
"port": $MCP_GATEWAY_PORT,
|
||||||
"domain": "${MCP_GATEWAY_DOMAIN}",
|
"domain": "${MCP_GATEWAY_DOMAIN}",
|
||||||
"apiKey": "${MCP_GATEWAY_API_KEY}"
|
"apiKey": "${MCP_GATEWAY_API_KEY}",
|
||||||
|
"payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MCPCONFIG_EOF
|
MCPCONFIG_EOF
|
||||||
|
|
@ -434,8 +430,8 @@ jobs:
|
||||||
engine_name: "GitHub Copilot CLI",
|
engine_name: "GitHub Copilot CLI",
|
||||||
model: process.env.GH_AW_MODEL_AGENT_COPILOT || "",
|
model: process.env.GH_AW_MODEL_AGENT_COPILOT || "",
|
||||||
version: "",
|
version: "",
|
||||||
agent_version: "0.0.402",
|
agent_version: "0.0.403",
|
||||||
cli_version: "v0.42.2",
|
cli_version: "v0.42.6",
|
||||||
workflow_name: "Code Simplifier",
|
workflow_name: "Code Simplifier",
|
||||||
experimental: false,
|
experimental: false,
|
||||||
supports_tools_allowlist: true,
|
supports_tools_allowlist: true,
|
||||||
|
|
@ -451,8 +447,8 @@ jobs:
|
||||||
staged: false,
|
staged: false,
|
||||||
allowed_domains: ["defaults"],
|
allowed_domains: ["defaults"],
|
||||||
firewall_enabled: true,
|
firewall_enabled: true,
|
||||||
awf_version: "v0.13.4",
|
awf_version: "v0.13.7",
|
||||||
awmg_version: "v0.0.98",
|
awmg_version: "v0.0.103",
|
||||||
steps: {
|
steps: {
|
||||||
firewall: "squid"
|
firewall: "squid"
|
||||||
},
|
},
|
||||||
|
|
@ -541,80 +537,7 @@ jobs:
|
||||||
</system>
|
</system>
|
||||||
PROMPT_EOF
|
PROMPT_EOF
|
||||||
cat << 'PROMPT_EOF' >> "$GH_AW_PROMPT"
|
cat << 'PROMPT_EOF' >> "$GH_AW_PROMPT"
|
||||||
## Report Structure Guidelines
|
{{#runtime-import .github/workflows/code-simplifier.md}}
|
||||||
|
|
||||||
### 1. Header Levels
|
|
||||||
**Use h3 (###) or lower for all headers in your issue report to maintain proper document hierarchy.**
|
|
||||||
|
|
||||||
When creating GitHub issues or discussions:
|
|
||||||
- Use `###` (h3) for main sections (e.g., "### Test Summary")
|
|
||||||
- Use `####` (h4) for subsections (e.g., "#### Device-Specific Results")
|
|
||||||
- Never use `##` (h2) or `#` (h1) in reports - these are reserved for titles
|
|
||||||
|
|
||||||
### 2. Progressive Disclosure
|
|
||||||
**Wrap detailed test results in `<details><summary><b>Section Name</b></summary>` tags to improve readability and reduce scrolling.**
|
|
||||||
|
|
||||||
Use collapsible sections for:
|
|
||||||
- Verbose details (full test logs, raw data)
|
|
||||||
- Secondary information (minor warnings, extra context)
|
|
||||||
- Per-item breakdowns when there are many items
|
|
||||||
|
|
||||||
Always keep critical information visible (summary, critical issues, key metrics).
|
|
||||||
|
|
||||||
### 3. Report Structure Pattern
|
|
||||||
|
|
||||||
1. **Overview**: 1-2 paragraphs summarizing key findings
|
|
||||||
2. **Critical Information**: Show immediately (summary stats, critical issues)
|
|
||||||
3. **Details**: Use `<details><summary><b>Section Name</b></summary>` for expanded content
|
|
||||||
4. **Context**: Add helpful metadata (workflow run, date, trigger)
|
|
||||||
|
|
||||||
### Design Principles (Airbnb-Inspired)
|
|
||||||
|
|
||||||
Reports should:
|
|
||||||
- **Build trust through clarity**: Most important info immediately visible
|
|
||||||
- **Exceed expectations**: Add helpful context like trends, comparisons
|
|
||||||
- **Create delight**: Use progressive disclosure to reduce overwhelm
|
|
||||||
- **Maintain consistency**: Follow patterns across all reports
|
|
||||||
|
|
||||||
### Example Report Structure
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
### Summary
|
|
||||||
- Key metric 1: value
|
|
||||||
- Key metric 2: value
|
|
||||||
- Status: ✅/⚠️/❌
|
|
||||||
|
|
||||||
### Critical Issues
|
|
||||||
[Always visible - these are important]
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>View Detailed Results</b></summary>
|
|
||||||
|
|
||||||
[Comprehensive details, logs, traces]
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><b>View All Warnings</b></summary>
|
|
||||||
|
|
||||||
[Minor issues and potential problems]
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Recommendations
|
|
||||||
[Actionable next steps - keep visible]
|
|
||||||
```
|
|
||||||
|
|
||||||
## 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)
|
|
||||||
|
|
||||||
|
|
||||||
PROMPT_EOF
|
|
||||||
cat << 'PROMPT_EOF' >> "$GH_AW_PROMPT"
|
|
||||||
{{#runtime-import workflows/code-simplifier.md}}
|
|
||||||
PROMPT_EOF
|
PROMPT_EOF
|
||||||
- name: Substitute placeholders
|
- name: Substitute placeholders
|
||||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
|
|
@ -670,7 +593,7 @@ jobs:
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
sudo -E awf --enable-chroot --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.13.4 --skip-pull --agent-image act \
|
sudo -E awf --enable-chroot --env-all --container-workdir "${GITHUB_WORKSPACE}" --allow-domains api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com --log-level info --proxy-logs-dir /tmp/gh-aw/sandbox/firewall/logs --enable-host-access --image-tag 0.13.7 --skip-pull \
|
||||||
-- '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-all-tools --allow-all-paths --share /tmp/gh-aw/sandbox/agent/logs/conversation.md --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_AGENT_COPILOT:+ --model "$GH_AW_MODEL_AGENT_COPILOT"}' \
|
-- '/usr/local/bin/copilot --add-dir /tmp/gh-aw/ --log-level all --log-dir /tmp/gh-aw/sandbox/agent/logs/ --add-dir "${GITHUB_WORKSPACE}" --disable-builtin-mcps --allow-all-tools --allow-all-paths --share /tmp/gh-aw/sandbox/agent/logs/conversation.md --prompt "$(cat /tmp/gh-aw/aw-prompts/prompt.txt)"${GH_AW_MODEL_AGENT_COPILOT:+ --model "$GH_AW_MODEL_AGENT_COPILOT"}' \
|
||||||
2>&1 | tee /tmp/gh-aw/agent-stdio.log
|
2>&1 | tee /tmp/gh-aw/agent-stdio.log
|
||||||
env:
|
env:
|
||||||
|
|
@ -738,7 +661,7 @@ jobs:
|
||||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
env:
|
env:
|
||||||
GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
|
GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }}
|
||||||
GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com"
|
GH_AW_ALLOWED_DOMAINS: "api.business.githubcopilot.com,api.enterprise.githubcopilot.com,api.github.com,api.githubcopilot.com,api.individual.githubcopilot.com,api.snapcraft.io,archive.ubuntu.com,azure.archive.ubuntu.com,crl.geotrust.com,crl.globalsign.com,crl.identrust.com,crl.sectigo.com,crl.thawte.com,crl.usertrust.com,crl.verisign.com,crl3.digicert.com,crl4.digicert.com,crls.ssl.com,github.com,host.docker.internal,json-schema.org,json.schemastore.org,keyserver.ubuntu.com,ocsp.digicert.com,ocsp.geotrust.com,ocsp.globalsign.com,ocsp.identrust.com,ocsp.sectigo.com,ocsp.ssl.com,ocsp.thawte.com,ocsp.usertrust.com,ocsp.verisign.com,packagecloud.io,packages.cloud.google.com,packages.microsoft.com,ppa.launchpad.net,raw.githubusercontent.com,registry.npmjs.org,s.symcb.com,s.symcd.com,security.ubuntu.com,telemetry.enterprise.githubcopilot.com,ts-crl.ws.symantec.com,ts-ocsp.ws.symantec.com"
|
||||||
GITHUB_SERVER_URL: ${{ github.server_url }}
|
GITHUB_SERVER_URL: ${{ github.server_url }}
|
||||||
GITHUB_API_URL: ${{ github.api_url }}
|
GITHUB_API_URL: ${{ github.api_url }}
|
||||||
with:
|
with:
|
||||||
|
|
@ -804,7 +727,7 @@ jobs:
|
||||||
/tmp/gh-aw/mcp-logs/
|
/tmp/gh-aw/mcp-logs/
|
||||||
/tmp/gh-aw/sandbox/firewall/logs/
|
/tmp/gh-aw/sandbox/firewall/logs/
|
||||||
/tmp/gh-aw/agent-stdio.log
|
/tmp/gh-aw/agent-stdio.log
|
||||||
/tmp/gh-aw/aw.patch
|
/tmp/gh-aw/agent/
|
||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
|
|
||||||
conclusion:
|
conclusion:
|
||||||
|
|
@ -826,7 +749,7 @@ jobs:
|
||||||
total_count: ${{ steps.missing_tool.outputs.total_count }}
|
total_count: ${{ steps.missing_tool.outputs.total_count }}
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
uses: github/gh-aw/actions/setup@c6d30bee9ffff7c09b8c491d5fd975284c538360 # v0.42.2
|
uses: github/gh-aw/actions/setup@v0.42.6
|
||||||
with:
|
with:
|
||||||
destination: /opt/gh-aw/actions
|
destination: /opt/gh-aw/actions
|
||||||
- name: Debug job inputs
|
- name: Debug job inputs
|
||||||
|
|
@ -897,6 +820,8 @@ jobs:
|
||||||
GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
|
GH_AW_AGENT_CONCLUSION: ${{ needs.agent.result }}
|
||||||
GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.agent.outputs.secret_verification_result }}
|
GH_AW_SECRET_VERIFICATION_RESULT: ${{ needs.agent.outputs.secret_verification_result }}
|
||||||
GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
|
GH_AW_CHECKOUT_PR_SUCCESS: ${{ needs.agent.outputs.checkout_pr_success }}
|
||||||
|
GH_AW_CREATE_DISCUSSION_ERRORS: ${{ needs.safe_outputs.outputs.create_discussion_errors }}
|
||||||
|
GH_AW_CREATE_DISCUSSION_ERROR_COUNT: ${{ needs.safe_outputs.outputs.create_discussion_error_count }}
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
|
|
@ -904,23 +829,6 @@ jobs:
|
||||||
setupGlobals(core, github, context, exec, io);
|
setupGlobals(core, github, context, exec, io);
|
||||||
const { main } = require('/opt/gh-aw/actions/handle_agent_failure.cjs');
|
const { main } = require('/opt/gh-aw/actions/handle_agent_failure.cjs');
|
||||||
await main();
|
await main();
|
||||||
- name: Handle Create Pull Request Error
|
|
||||||
id: handle_create_pr_error
|
|
||||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
|
||||||
env:
|
|
||||||
GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
|
|
||||||
GH_AW_WORKFLOW_NAME: "Code Simplifier"
|
|
||||||
GH_AW_WORKFLOW_SOURCE: "github/gh-aw/.github/workflows/code-simplifier.md@76d37d925abd44fee97379206f105b74b91a285b"
|
|
||||||
GH_AW_WORKFLOW_SOURCE_URL: "${{ github.server_url }}/github/gh-aw/tree/76d37d925abd44fee97379206f105b74b91a285b/.github/workflows/code-simplifier.md"
|
|
||||||
GH_AW_TRACKER_ID: "code-simplifier"
|
|
||||||
GH_AW_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
|
||||||
script: |
|
|
||||||
const { setupGlobals } = require('/opt/gh-aw/actions/setup_globals.cjs');
|
|
||||||
setupGlobals(core, github, context, exec, io);
|
|
||||||
const { main } = require('/opt/gh-aw/actions/handle_create_pr_error.cjs');
|
|
||||||
await main();
|
|
||||||
- name: Update reaction comment with completion status
|
- name: Update reaction comment with completion status
|
||||||
id: conclusion
|
id: conclusion
|
||||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
|
|
@ -946,12 +854,14 @@ jobs:
|
||||||
if: needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true'
|
if: needs.agent.outputs.output_types != '' || needs.agent.outputs.has_patch == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions: {}
|
permissions: {}
|
||||||
|
concurrency:
|
||||||
|
group: "gh-aw-copilot-${{ github.workflow }}"
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
outputs:
|
outputs:
|
||||||
success: ${{ steps.parse_results.outputs.success }}
|
success: ${{ steps.parse_results.outputs.success }}
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
uses: github/gh-aw/actions/setup@c6d30bee9ffff7c09b8c491d5fd975284c538360 # v0.42.2
|
uses: github/gh-aw/actions/setup@v0.42.6
|
||||||
with:
|
with:
|
||||||
destination: /opt/gh-aw/actions
|
destination: /opt/gh-aw/actions
|
||||||
- name: Download agent artifacts
|
- name: Download agent artifacts
|
||||||
|
|
@ -993,7 +903,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
|
||||||
- name: Install GitHub Copilot CLI
|
- name: Install GitHub Copilot CLI
|
||||||
run: /opt/gh-aw/actions/install_copilot_cli.sh 0.0.402
|
run: /opt/gh-aw/actions/install_copilot_cli.sh 0.0.403
|
||||||
- name: Execute GitHub Copilot CLI
|
- name: Execute GitHub Copilot CLI
|
||||||
id: agentic_execution
|
id: agentic_execution
|
||||||
# Copilot CLI tool arguments (sorted):
|
# Copilot CLI tool arguments (sorted):
|
||||||
|
|
@ -1046,7 +956,7 @@ jobs:
|
||||||
activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_skip_if_match.outputs.skip_check_ok == 'true') }}
|
activated: ${{ (steps.check_membership.outputs.is_team_member == 'true') && (steps.check_skip_if_match.outputs.skip_check_ok == 'true') }}
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
uses: github/gh-aw/actions/setup@c6d30bee9ffff7c09b8c491d5fd975284c538360 # v0.42.2
|
uses: github/gh-aw/actions/setup@v0.42.6
|
||||||
with:
|
with:
|
||||||
destination: /opt/gh-aw/actions
|
destination: /opt/gh-aw/actions
|
||||||
- name: Check team membership for workflow
|
- name: Check team membership for workflow
|
||||||
|
|
@ -1077,17 +987,17 @@ jobs:
|
||||||
|
|
||||||
safe_outputs:
|
safe_outputs:
|
||||||
needs:
|
needs:
|
||||||
- activation
|
|
||||||
- agent
|
- agent
|
||||||
- detection
|
- detection
|
||||||
if: ((!cancelled()) && (needs.agent.result != 'skipped')) && (needs.detection.outputs.success == 'true')
|
if: ((!cancelled()) && (needs.agent.result != 'skipped')) && (needs.detection.outputs.success == 'true')
|
||||||
runs-on: ubuntu-slim
|
runs-on: ubuntu-slim
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
discussions: write
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
env:
|
env:
|
||||||
|
GH_AW_ENGINE_ID: "copilot"
|
||||||
GH_AW_TRACKER_ID: "code-simplifier"
|
GH_AW_TRACKER_ID: "code-simplifier"
|
||||||
GH_AW_WORKFLOW_ID: "code-simplifier"
|
GH_AW_WORKFLOW_ID: "code-simplifier"
|
||||||
GH_AW_WORKFLOW_NAME: "Code Simplifier"
|
GH_AW_WORKFLOW_NAME: "Code Simplifier"
|
||||||
|
|
@ -1100,7 +1010,7 @@ jobs:
|
||||||
process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }}
|
process_safe_outputs_temporary_id_map: ${{ steps.process_safe_outputs.outputs.temporary_id_map }}
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Scripts
|
- name: Setup Scripts
|
||||||
uses: github/gh-aw/actions/setup@c6d30bee9ffff7c09b8c491d5fd975284c538360 # v0.42.2
|
uses: github/gh-aw/actions/setup@v0.42.6
|
||||||
with:
|
with:
|
||||||
destination: /opt/gh-aw/actions
|
destination: /opt/gh-aw/actions
|
||||||
- name: Download agent output artifact
|
- name: Download agent output artifact
|
||||||
|
|
@ -1114,38 +1024,12 @@ jobs:
|
||||||
mkdir -p /tmp/gh-aw/safeoutputs/
|
mkdir -p /tmp/gh-aw/safeoutputs/
|
||||||
find "/tmp/gh-aw/safeoutputs/" -type f -print
|
find "/tmp/gh-aw/safeoutputs/" -type f -print
|
||||||
echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/safeoutputs/agent_output.json" >> "$GITHUB_ENV"
|
echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/safeoutputs/agent_output.json" >> "$GITHUB_ENV"
|
||||||
- name: Download patch artifact
|
|
||||||
continue-on-error: true
|
|
||||||
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
|
|
||||||
with:
|
|
||||||
name: agent-artifacts
|
|
||||||
path: /tmp/gh-aw/
|
|
||||||
- name: Checkout repository
|
|
||||||
if: ((!cancelled()) && (needs.agent.result != 'skipped')) && (contains(needs.agent.outputs.output_types, 'create_pull_request'))
|
|
||||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
|
|
||||||
with:
|
|
||||||
token: ${{ github.token }}
|
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 1
|
|
||||||
- name: Configure Git credentials
|
|
||||||
if: ((!cancelled()) && (needs.agent.result != 'skipped')) && (contains(needs.agent.outputs.output_types, 'create_pull_request'))
|
|
||||||
env:
|
|
||||||
REPO_NAME: ${{ github.repository }}
|
|
||||||
SERVER_URL: ${{ github.server_url }}
|
|
||||||
GIT_TOKEN: ${{ github.token }}
|
|
||||||
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:${GIT_TOKEN}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git"
|
|
||||||
echo "Git configured with standard GitHub Actions identity"
|
|
||||||
- name: Process Safe Outputs
|
- name: Process Safe Outputs
|
||||||
id: process_safe_outputs
|
id: process_safe_outputs
|
||||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
env:
|
env:
|
||||||
GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
|
GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }}
|
||||||
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_pull_request\":{\"base_branch\":\"${{ github.ref_name }}\",\"expires\":168,\"labels\":[\"refactoring\",\"code-quality\",\"automation\"],\"max\":1,\"max_patch_size\":1024,\"title_prefix\":\"[code-simplifier] \"},\"missing_data\":{},\"missing_tool\":{}}"
|
GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"create_discussion\":{\"category\":\"general\",\"expires\":168,\"fallback_to_issue\":true,\"labels\":[\"refactoring\",\"code-quality\",\"automation\"],\"max\":1,\"title_prefix\":\"[code-simplifier] \"},\"missing_data\":{},\"missing_tool\":{}}"
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
|
|
|
||||||
100
.github/workflows/code-simplifier.md
vendored
100
.github/workflows/code-simplifier.md
vendored
|
|
@ -6,17 +6,14 @@ permissions:
|
||||||
contents: read
|
contents: read
|
||||||
issues: read
|
issues: read
|
||||||
pull-requests: read
|
pull-requests: read
|
||||||
imports:
|
discussions: read
|
||||||
- github/gh-aw/.github/workflows/shared/reporting.md@76d37d925abd44fee97379206f105b74b91a285b
|
|
||||||
safe-outputs:
|
safe-outputs:
|
||||||
create-pull-request:
|
create-discussion:
|
||||||
expires: 7d
|
category: "general"
|
||||||
labels:
|
labels:
|
||||||
- refactoring
|
- refactoring
|
||||||
- code-quality
|
- code-quality
|
||||||
- automation
|
- automation
|
||||||
reviewers:
|
|
||||||
- copilot
|
|
||||||
title-prefix: "[code-simplifier] "
|
title-prefix: "[code-simplifier] "
|
||||||
description: Analyzes recently modified code and creates pull requests with simplifications that improve clarity, consistency, and maintainability while preserving functionality
|
description: Analyzes recently modified code and creates pull requests with simplifications that improve clarity, consistency, and maintainability while preserving functionality
|
||||||
name: Code Simplifier
|
name: Code Simplifier
|
||||||
|
|
@ -38,7 +35,7 @@ You are an expert code simplification specialist focused on enhancing code clari
|
||||||
|
|
||||||
## Your Mission
|
## Your Mission
|
||||||
|
|
||||||
Analyze recently modified code from the last 24 hours and apply refinements that improve code quality while preserving all functionality. Create a pull request with the simplified code if improvements are found.
|
Analyze recently modified code from the last 24 hours and apply refinements that improve code quality while preserving all functionality. Create a GitHub discussion with a properly formatted diff if improvements are found.
|
||||||
|
|
||||||
## Current Context
|
## Current Context
|
||||||
|
|
||||||
|
|
@ -242,11 +239,11 @@ npm run build
|
||||||
python -m py_compile changed_files.py
|
python -m py_compile changed_files.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## Phase 4: Create Pull Request
|
## Phase 4: Create GitHub Discussion with Diff
|
||||||
|
|
||||||
### 4.1 Determine If PR Is Needed
|
### 4.1 Determine If Discussion Is Needed
|
||||||
|
|
||||||
Only create a PR if:
|
Only create a discussion if:
|
||||||
- ✅ You made actual code simplifications
|
- ✅ You made actual code simplifications
|
||||||
- ✅ All tests pass
|
- ✅ All tests pass
|
||||||
- ✅ Linting is clean
|
- ✅ Linting is clean
|
||||||
|
|
@ -260,14 +257,42 @@ If no improvements were made or changes broke tests, exit gracefully:
|
||||||
No simplifications needed - code already meets quality standards.
|
No simplifications needed - code already meets quality standards.
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4.2 Generate PR Description
|
### 4.2 Generate Git Diff
|
||||||
|
|
||||||
If creating a PR, use this structure:
|
Before creating the discussion, generate a properly formatted git diff that can be used to create a pull request:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Stage all changes if not already staged
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Generate a complete unified diff of all staged changes
|
||||||
|
git diff --cached > /tmp/code-simplification.diff
|
||||||
|
|
||||||
|
# Read the diff to include in the discussion
|
||||||
|
cat /tmp/code-simplification.diff
|
||||||
|
```
|
||||||
|
|
||||||
|
**Important**: The diff must be in standard unified diff format (git unified diff) that includes:
|
||||||
|
- File headers with `diff --git a/path b/path`
|
||||||
|
- Index lines with git hashes
|
||||||
|
- `---` and `+++` lines showing old and new file paths
|
||||||
|
- `@@` lines showing line numbers
|
||||||
|
- Actual code changes with `-` for removed lines and `+` for added lines
|
||||||
|
|
||||||
|
This format is compatible with:
|
||||||
|
- `git apply` command for direct application
|
||||||
|
- GitHub's "Create PR from diff" functionality
|
||||||
|
- GitHub Copilot for suggesting PR creation
|
||||||
|
- Manual copy-paste into PR creation interface
|
||||||
|
|
||||||
|
### 4.3 Generate Discussion Description
|
||||||
|
|
||||||
|
If creating a discussion, use this structure:
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
## Code Simplification - [Date]
|
## Code Simplification - [Date]
|
||||||
|
|
||||||
This PR simplifies recently modified code to improve clarity, consistency, and maintainability while preserving all functionality.
|
This discussion presents code simplifications that improve clarity, consistency, and maintainability while preserving all functionality.
|
||||||
|
|
||||||
### Files Simplified
|
### Files Simplified
|
||||||
|
|
||||||
|
|
@ -298,11 +323,37 @@ Recent changes from:
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
- ✅ All tests pass (`make test-unit`)
|
- ✅ All tests pass
|
||||||
- ✅ Linting passes (`make lint`)
|
- ✅ Linting passes
|
||||||
- ✅ Build succeeds (`make build`)
|
- ✅ Build succeeds
|
||||||
- ✅ No functional changes - behavior is identical
|
- ✅ No functional changes - behavior is identical
|
||||||
|
|
||||||
|
### Git Diff
|
||||||
|
|
||||||
|
Below is the complete diff that can be used to create a pull request. You can copy this diff and:
|
||||||
|
- Use it with GitHub Copilot to create a PR
|
||||||
|
- Apply it directly with `git apply`
|
||||||
|
- Create a PR manually by copying the changes
|
||||||
|
|
||||||
|
```diff
|
||||||
|
[PASTE THE COMPLETE GIT DIFF HERE]
|
||||||
|
```
|
||||||
|
|
||||||
|
To apply this diff:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Save the diff to a file
|
||||||
|
cat > /tmp/code-simplification.diff << 'EOF'
|
||||||
|
[PASTE DIFF CONTENT]
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Apply the diff
|
||||||
|
git apply /tmp/code-simplification.diff
|
||||||
|
|
||||||
|
# Or create a PR from the current branch
|
||||||
|
gh pr create --title "[code-simplifier] Code Simplification" --body "See discussion #[NUMBER]"
|
||||||
|
```
|
||||||
|
|
||||||
### Review Focus
|
### Review Focus
|
||||||
|
|
||||||
Please verify:
|
Please verify:
|
||||||
|
|
@ -316,14 +367,14 @@ Please verify:
|
||||||
*Automated by Code Simplifier Agent - analyzing code from the last 24 hours*
|
*Automated by Code Simplifier Agent - analyzing code from the last 24 hours*
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4.3 Use Safe Outputs
|
### 4.4 Use Safe Outputs
|
||||||
|
|
||||||
Create the pull request using the safe-outputs configuration:
|
Create the discussion using the safe-outputs configuration:
|
||||||
|
|
||||||
- Title will be prefixed with `[code-simplifier]`
|
- Title will be prefixed with `[code-simplifier]`
|
||||||
- Labeled with `refactoring`, `code-quality`, `automation`
|
- Labeled with `refactoring`, `code-quality`, `automation`
|
||||||
- Assigned to `copilot` for review
|
- Posted to the "General" discussion category
|
||||||
- Set as ready for review (not draft)
|
- Contains complete git diff for easy PR creation
|
||||||
|
|
||||||
## Important Guidelines
|
## Important Guidelines
|
||||||
|
|
||||||
|
|
@ -340,7 +391,7 @@ Create the pull request using the safe-outputs configuration:
|
||||||
- **Clear over clever**: Prioritize readability and maintainability
|
- **Clear over clever**: Prioritize readability and maintainability
|
||||||
|
|
||||||
### Exit Conditions
|
### Exit Conditions
|
||||||
Exit gracefully without creating a PR if:
|
Exit gracefully without creating a discussion if:
|
||||||
- No code was changed in the last 24 hours
|
- No code was changed in the last 24 hours
|
||||||
- No simplifications are beneficial
|
- No simplifications are beneficial
|
||||||
- Tests fail after changes
|
- Tests fail after changes
|
||||||
|
|
@ -372,6 +423,9 @@ Your output MUST either:
|
||||||
No simplifications needed - code already meets quality standards.
|
No simplifications needed - code already meets quality standards.
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **If simplifications made**: Create a PR with the changes using safe-outputs
|
3. **If simplifications made**: Create a discussion with the changes using safe-outputs, including:
|
||||||
|
- Clear description of improvements
|
||||||
|
- Complete git diff in proper format
|
||||||
|
- Instructions for applying the diff or creating a PR
|
||||||
|
|
||||||
Begin your code simplification analysis now. Find recently modified code, assess simplification opportunities, apply improvements while preserving functionality, validate changes, and create a PR if beneficial.
|
Begin your code simplification analysis now. Find recently modified code, assess simplification opportunities, apply improvements while preserving functionality, validate changes, and create a discussion with a git diff if beneficial.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue