| 1 | name: Copilot Pricing Review |
| 2 | |
| 3 | on: |
| 4 | schedule: |
| 5 | # Run every two months on the 6th, matching the pricing table's 2026-06-06 review baseline. |
| 6 | - cron: "23 9 6 2,4,6,8,10,12 *" |
| 7 | workflow_dispatch: |
| 8 | |
| 9 | permissions: |
| 10 | contents: read |
| 11 | |
| 12 | concurrency: |
| 13 | group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | cancel-in-progress: false |
| 15 | |
| 16 | jobs: |
| 17 | review-pricing: |
| 18 | runs-on: ubuntu-latest |
| 19 | permissions: |
| 20 | contents: read # checkout the pricing-review script |
| 21 | issues: write # create/update the pricing-review tracking issue |
| 22 | steps: |
| 23 | # Pinned to a full commit SHA so zizmor can verify the checkout action. |
| 24 | - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 25 | with: |
| 26 | persist-credentials: false |
| 27 | |
| 28 | - name: Capture Copilot pricing source metadata |
| 29 | run: | |
| 30 | curl -fsSLI "https://docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing" > copilot-pricing-source-headers.txt || true |
| 31 | |
| 32 | - name: Check Copilot pricing review status |
| 33 | id: pricing |
| 34 | run: | |
| 35 | python3 scripts/check_copilot_pricing_review.py \ |
| 36 | --source-headers copilot-pricing-source-headers.txt \ |
| 37 | --output copilot-pricing-review.md \ |
| 38 | --github-output "$GITHUB_OUTPUT" |
| 39 | |
| 40 | - name: Create or update pricing review issue |
| 41 | if: steps.pricing.outputs.needs_review == 'true' |
| 42 | env: |
| 43 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | GH_REPO: ${{ github.repository }} |
| 45 | run: | |
| 46 | set -euo pipefail |
| 47 | TITLE="Copilot model pricing review required" |
| 48 | EXISTING=$(gh issue list --state open --search "in:title \"$TITLE\"" --json number --jq '.[0].number // empty') |
| 49 | if [ -n "$EXISTING" ]; then |
| 50 | gh issue comment "$EXISTING" --body-file copilot-pricing-review.md |
| 51 | echo "Updated existing pricing review issue #$EXISTING" |
| 52 | else |
| 53 | gh issue create \ |
| 54 | --title "$TITLE" \ |
| 55 | --label squad \ |
| 56 | --body-file copilot-pricing-review.md |
| 57 | fi |