Skip to content

ci: add published workflows for execution #106

ci: add published workflows for execution

ci: add published workflows for execution #106

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
- cron: "30 11 * * 1-5"
workflow_dispatch:
inputs:
run_trials:
description: Run published workflows end-to-end to verify they produce results
required: false
default: false
type: boolean
jobs:
compile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up gh-aw CLI
uses: github/gh-aw-actions/setup-cli@f8495a686e66770ae977f82732f34d7340ee42a4 # setup-cli action pin (installs CLI v0.72.1 below)
with:
version: v0.72.1
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Compile workflows
run: |
gh aw compile
gh aw compile --dir workflows
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
add:
runs-on: ubuntu-latest
needs: [compile]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up gh-aw CLI
uses: github/gh-aw-actions/setup-cli@f8495a686e66770ae977f82732f34d7340ee42a4 # setup-cli action pin (installs CLI v0.72.1 below)
with:
version: v0.72.1
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test gh aw add from local sources
run: |
TARGET_REPO=$(mktemp -d)
git init "$TARGET_REPO"
cd "$TARGET_REPO"
gh aw add "${{ github.workspace }}/workflows/copilot-token-audit.md" "${{ github.workspace }}/workflows/copilot-token-optimizer.md"
gh aw compile --validate --no-emit
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
runs-on: ubuntu-latest
needs: [add]
permissions:
contents: read
if: >-
github.event_name == 'schedule' ||
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_trials == 'true')
steps:
- name: Create GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.AGENTIC_OPS_APP_ID }}
private-key: ${{ secrets.AGENTIC_OPS_PRIVATE_KEY }}
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- name: Set up gh-aw CLI
uses: github/gh-aw-actions/setup-cli@f8495a686e66770ae977f82732f34d7340ee42a4 # setup-cli action pin (installs CLI v0.72.1 below)
with:
version: v0.72.1
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run published workflows from temporary branch
run: |
RUN_BRANCH="ci/aw-trials-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
git switch --create "$RUN_BRANCH"
gh aw add "${{ github.workspace }}/workflows/copilot-token-audit.md" "${{ github.workspace }}/workflows/copilot-token-optimizer.md"
gh aw compile
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .github/workflows/copilot-token-audit.md .github/workflows/copilot-token-audit.lock.yml
git add .github/workflows/copilot-token-optimizer.md .github/workflows/copilot-token-optimizer.lock.yml
git commit -m "ci: add published workflows for execution"
git push --set-upstream origin "$RUN_BRANCH"
gh aw run copilot-token-audit copilot-token-optimizer --ref "$RUN_BRANCH"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}