Skip to content

Commit 7ebfada

Browse files
committed
chore: improve local testing of published workflows
1 parent bdad8cf commit 7ebfada

1 file changed

Lines changed: 30 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ name: CI
33
on:
44
push:
55
pull_request:
6+
schedule:
7+
- cron: "30 11 * * 1-5"
68
workflow_dispatch:
9+
inputs:
10+
run_trials:
11+
description: Run published workflows end-to-end to verify they produce results
12+
required: false
13+
default: false
14+
type: boolean
715

816
jobs:
917
compile:
@@ -26,29 +34,33 @@ jobs:
2634

2735
add:
2836
runs-on: ubuntu-latest
37+
needs: [compile]
2938
steps:
39+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
40+
3041
- name: Set up gh-aw CLI
3142
uses: github/gh-aw-actions/setup-cli@f8495a686e66770ae977f82732f34d7340ee42a4 # v0.71.4
3243
with:
3344
version: v0.71.4
3445
github-token: ${{ secrets.GITHUB_TOKEN }}
3546

36-
- name: Initialize target repository
47+
- name: Test gh aw add from local sources
3748
run: |
3849
TARGET_REPO=$(mktemp -d)
39-
echo "TARGET_REPO=$TARGET_REPO" >> "$GITHUB_ENV"
4050
git init "$TARGET_REPO"
41-
42-
- name: Add workflows
43-
working-directory: ${{ env.TARGET_REPO }}
44-
run: gh aw add githubnext/agentic-ops/copilot-token-audit githubnext/agentic-ops/copilot-token-optimizer
51+
cd "$TARGET_REPO"
52+
gh aw add "${{ github.workspace }}/workflows/copilot-token-audit.md" "${{ github.workspace }}/workflows/copilot-token-optimizer.md"
53+
gh aw compile --validate --no-emit
4554
env:
4655
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4756

4857
run:
4958
runs-on: ubuntu-latest
50-
needs: [compile]
51-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
59+
needs: [add]
60+
if: >-
61+
github.event_name == 'schedule' ||
62+
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
63+
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_trials == 'true')
5264
steps:
5365
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
5466

@@ -58,9 +70,16 @@ jobs:
5870
version: v0.71.4
5971
github-token: ${{ secrets.GITHUB_TOKEN }}
6072

61-
- name: Run published workflows on this repo
73+
- name: Install published workflows locally
74+
run: |
75+
gh aw add "${{ github.workspace }}/workflows/copilot-token-audit.md" "${{ github.workspace }}/workflows/copilot-token-optimizer.md"
76+
gh aw compile
77+
env:
78+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Run published workflows
6281
run: |
63-
gh aw run copilot-token-audit --ref main
64-
gh aw run copilot-token-optimizer --ref main
82+
gh aw run copilot-token-audit --push --ref "${{ github.ref_name }}"
83+
gh aw run copilot-token-optimizer --push --ref "${{ github.ref_name }}"
6584
env:
6685
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)