Copilot Prompt Improvement (Scheduled) #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Copilot Prompt Improvement (Scheduled) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| scope: | |
| description: "Paths or globs of prompts to improve" | |
| required: false | |
| default: "user_prompts/**" | |
| improvement_type: | |
| description: "incremental | comprehensive | targeted" | |
| required: false | |
| default: "incremental" | |
| change_threshold: | |
| description: "Max percent change (e.g., 15%)" | |
| required: false | |
| default: "15%" | |
| optimization_focus: | |
| description: "all | clarity | redundancy | modularity" | |
| required: false | |
| default: "clarity" | |
| schedule: | |
| # Run every Monday at 14:00 UTC | |
| - cron: "0 14 * * 1" | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| open_issue: | |
| name: Open/Update Prompt Improvement Issue | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Prepare issue body | |
| id: prep | |
| run: | | |
| SCOPE_INPUT="${{ github.event.inputs.scope }}" | |
| IMPROVEMENT_TYPE_INPUT="${{ github.event.inputs.improvement_type }}" | |
| CHANGE_THRESHOLD_INPUT="${{ github.event.inputs.change_threshold }}" | |
| OPT_FOCUS_INPUT="${{ github.event.inputs.optimization_focus }}" | |
| # Defaults for scheduled runs where inputs are empty | |
| if [ -z "$SCOPE_INPUT" ]; then SCOPE_INPUT="user_prompts/**"; fi | |
| if [ -z "$IMPROVEMENT_TYPE_INPUT" ]; then IMPROVEMENT_TYPE_INPUT="incremental"; fi | |
| if [ -z "$CHANGE_THRESHOLD_INPUT" ]; then CHANGE_THRESHOLD_INPUT="15%"; fi | |
| if [ -z "$OPT_FOCUS_INPUT" ]; then OPT_FOCUS_INPUT="clarity"; fi | |
| ISSUE_TITLE="[Prompt Improvement] Weekly upkeep — ${IMPROVEMENT_TYPE_INPUT} (${OPT_FOCUS_INPUT})" | |
| cat > issue_body.md << 'EOF' | |
| Use the Copilot coding agent to iteratively improve prompts. | |
| Scope: $SCOPE_INPUT | |
| IMPROVEMENT_TYPE: $IMPROVEMENT_TYPE_INPUT | |
| CHANGE_THRESHOLD: $CHANGE_THRESHOLD_INPUT | |
| OPTIMIZATION_FOCUS: $OPT_FOCUS_INPUT | |
| Goals & Success Criteria: | |
| - Maintain all capabilities and guardrails defined in prompt_engineering_assistant.system.prompt.md | |
| - Keep total changes within CHANGE_THRESHOLD (prefer smaller, incremental diffs) | |
| - Improve clarity, reduce redundancy, and enhance modularity without behavior change | |
| Instructions for Copilot: | |
| - Follow the methodology and guardrails in .github/chatmodes/prompt_engineering_assistant.chatmode.md | |
| - Research → Test → Improve → Confirm; add concise diffs and clear commit messages | |
| - If public behavior changes, add/update minimal tests/docs | |
| Handoff hashtag (for VS Code / chat tools): | |
| #github-pull-request_copilot-coding-agent | |
| EOF | |
| # Expose values | |
| echo "title<<EOF" >> $GITHUB_OUTPUT | |
| echo "$ISSUE_TITLE" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create or update issue | |
| uses: peter-evans/create-issue-from-file@v5 | |
| with: | |
| title: ${{ steps.prep.outputs.title }} | |
| content-filepath: issue_body.md | |
| labels: copilot-agent,prompt-improvement | |
| assignees: github-copilot-agent | |
| # If an open issue with same title exists, update it; else create new | |
| update-existing: true | |
| - name: Output next steps | |
| run: | | |
| echo "Issue created or updated. Assigning to 'github-copilot-agent' triggers Copilot to work." | |
| echo "You can also run this workflow manually with custom inputs via the 'Run workflow' button." | |
| # Notes | |
| # - This workflow opens/updates a single weekly issue for prompt improvements and assigns it | |
| # to the Copilot coding agent. Copilot then creates a branch and PR. | |
| # - Customize the cron as desired. Keep scope small for incremental changes. | |
| # - Ensure you have access to Copilot coding agent and that repository policies permit it. |