Add Daily Sub-Agent Optimizer to the agentic-ops bundle #166
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: CI | |
| on: | |
| push: | |
| pull_request: | |
| 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 }} | |
| - name: Verify compiled workflows are committed | |
| run: git diff --exit-code -- .github/workflows workflows | |
| add-local-source: | |
| 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: | | |
| set -euo pipefail | |
| TARGET_REPO=$(mktemp -d) | |
| git init "$TARGET_REPO" | |
| cd "$TARGET_REPO" | |
| gh aw add "${{ github.workspace }}/workflows/agentic-token-audit.md" "${{ github.workspace }}/workflows/agentic-token-optimizer.md" "${{ github.workspace }}/workflows/daily-subagent-optimizer.md" | |
| gh aw compile --validate --no-emit | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| add-named-source: | |
| runs-on: ubuntu-latest | |
| needs: [compile] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| 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 named sources | |
| run: | | |
| set -euo pipefail | |
| TARGET_REPO=$(mktemp -d) | |
| git init "$TARGET_REPO" | |
| cd "$TARGET_REPO" | |
| gh aw add "${{ github.repository }}/agentic-token-audit" "${{ github.repository }}/agentic-token-optimizer" "${{ github.repository }}/daily-subagent-optimizer" | |
| gh aw compile --validate --no-emit | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | |
| runs-on: ubuntu-latest | |
| needs: [add-local-source, add-named-source] | |
| permissions: | |
| actions: write | |
| contents: read | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| fetch-depth: 0 | |
| - 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: Detect installed workflows on main | |
| id: detect-workflows | |
| run: | | |
| set -euo pipefail | |
| installed=true | |
| for path in \ | |
| .github/workflows/agentic-token-audit.md \ | |
| .github/workflows/agentic-token-audit.lock.yml \ | |
| .github/workflows/agentic-token-optimizer.md \ | |
| .github/workflows/agentic-token-optimizer.lock.yml \ | |
| .github/workflows/daily-subagent-optimizer.md \ | |
| .github/workflows/daily-subagent-optimizer.lock.yml; do | |
| if [[ ! -f "$path" ]]; then | |
| echo "Missing installed workflow file: $path" | |
| installed=false | |
| fi | |
| done | |
| echo "installed=$installed" >> "$GITHUB_OUTPUT" | |
| if [[ "$installed" != "true" ]]; then | |
| { | |
| echo "### Run Result" | |
| echo | |
| echo "- Installed workflow files are not present on this main branch checkout yet." | |
| echo "- The install job must merge them into main before the real workflow dispatch can happen." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| - name: Run installed workflows from main | |
| if: steps.detect-workflows.outputs.installed == 'true' | |
| run: | | |
| set -euo pipefail | |
| gh aw run agentic-token-audit agentic-token-optimizer daily-subagent-optimizer --ref main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |