Skip to content

chore: improve local testing of published workflows #86

chore: improve local testing of published workflows

chore: improve local testing of published workflows #86

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 # v0.71.4
with:
version: v0.71.4
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 # v0.71.4
with:
version: v0.71.4
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]
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:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up gh-aw CLI
uses: github/gh-aw-actions/setup-cli@f8495a686e66770ae977f82732f34d7340ee42a4 # v0.71.4
with:
version: v0.71.4
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install published workflows locally
run: |
gh aw add "${{ github.workspace }}/workflows/copilot-token-audit.md" "${{ github.workspace }}/workflows/copilot-token-optimizer.md"
gh aw compile
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run published workflows
run: |
gh aw run copilot-token-audit --push --ref "${{ github.ref_name }}"
gh aw run copilot-token-optimizer --push --ref "${{ github.ref_name }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}