|
|
@@ -12,9 +12,57 @@ on:
|
|
|
workflow_dispatch:
|
|
|
|
|
|
jobs:
|
|
|
+ # Check if this is a PR merge commit (skip tests if so - they already ran on PR)
|
|
|
+ check-trigger:
|
|
|
+ name: Check Trigger Type
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ outputs:
|
|
|
+ should_test: ${{ steps.check.outputs.should_test }}
|
|
|
+ should_bump: ${{ steps.check.outputs.should_bump }}
|
|
|
+ steps:
|
|
|
+ - name: Determine if tests should run
|
|
|
+ id: check
|
|
|
+ run: |
|
|
|
+ # For PRs, always run tests
|
|
|
+ if [ "${{ github.event_name }}" == "pull_request" ]; then
|
|
|
+ echo "should_test=true" >> $GITHUB_OUTPUT
|
|
|
+ echo "should_bump=false" >> $GITHUB_OUTPUT
|
|
|
+ echo "PR detected - will run tests"
|
|
|
+ exit 0
|
|
|
+ fi
|
|
|
+
|
|
|
+ # For workflow_dispatch, always run tests
|
|
|
+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
|
|
+ echo "should_test=true" >> $GITHUB_OUTPUT
|
|
|
+ echo "should_bump=false" >> $GITHUB_OUTPUT
|
|
|
+ echo "Manual trigger - will run tests"
|
|
|
+ exit 0
|
|
|
+ fi
|
|
|
+
|
|
|
+ # For push events, check if it's a PR merge
|
|
|
+ COMMIT_MSG="${{ github.event.head_commit.message }}"
|
|
|
+
|
|
|
+ # PR merges have messages like "Merge pull request #123" or contain (#123)
|
|
|
+ if echo "$COMMIT_MSG" | grep -qE "^Merge pull request #|^.*\(#[0-9]+\)$"; then
|
|
|
+ echo "should_test=false" >> $GITHUB_OUTPUT
|
|
|
+ echo "should_bump=true" >> $GITHUB_OUTPUT
|
|
|
+ echo "PR merge detected - skipping tests, will bump version"
|
|
|
+ # Skip version bump commits
|
|
|
+ elif echo "$COMMIT_MSG" | grep -qE "^\[skip ci\]|chore: bump version"; then
|
|
|
+ echo "should_test=false" >> $GITHUB_OUTPUT
|
|
|
+ echo "should_bump=false" >> $GITHUB_OUTPUT
|
|
|
+ echo "Version bump commit - skipping everything"
|
|
|
+ else
|
|
|
+ echo "should_test=true" >> $GITHUB_OUTPUT
|
|
|
+ echo "should_bump=true" >> $GITHUB_OUTPUT
|
|
|
+ echo "Direct push detected - will run tests and bump version"
|
|
|
+ fi
|
|
|
+
|
|
|
test-openagent:
|
|
|
name: Test OpenAgent
|
|
|
runs-on: ubuntu-latest
|
|
|
+ needs: check-trigger
|
|
|
+ if: needs.check-trigger.outputs.should_test == 'true'
|
|
|
timeout-minutes: 15
|
|
|
|
|
|
steps:
|
|
|
@@ -65,6 +113,8 @@ jobs:
|
|
|
test-opencoder:
|
|
|
name: Test OpenCoder
|
|
|
runs-on: ubuntu-latest
|
|
|
+ needs: check-trigger
|
|
|
+ if: needs.check-trigger.outputs.should_test == 'true'
|
|
|
timeout-minutes: 15
|
|
|
|
|
|
steps:
|
|
|
@@ -115,8 +165,8 @@ jobs:
|
|
|
report-results:
|
|
|
name: Report Test Results
|
|
|
runs-on: ubuntu-latest
|
|
|
- needs: [test-openagent, test-opencoder]
|
|
|
- if: always()
|
|
|
+ needs: [check-trigger, test-openagent, test-opencoder]
|
|
|
+ if: always() && needs.check-trigger.outputs.should_test == 'true'
|
|
|
|
|
|
steps:
|
|
|
- name: Download OpenAgent results
|
|
|
@@ -152,8 +202,16 @@ jobs:
|
|
|
auto-version-bump:
|
|
|
name: Auto Version Bump
|
|
|
runs-on: ubuntu-latest
|
|
|
- needs: [test-openagent, test-opencoder]
|
|
|
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
|
+ needs: [check-trigger, test-openagent, test-opencoder]
|
|
|
+ # Run version bump if:
|
|
|
+ # 1. Tests ran and passed, OR
|
|
|
+ # 2. This is a PR merge (tests already passed on PR)
|
|
|
+ if: |
|
|
|
+ github.event_name == 'push' &&
|
|
|
+ github.ref == 'refs/heads/main' &&
|
|
|
+ needs.check-trigger.outputs.should_bump == 'true' &&
|
|
|
+ (needs.check-trigger.outputs.should_test == 'false' ||
|
|
|
+ (needs.test-openagent.result == 'success' && needs.test-opencoder.result == 'success'))
|
|
|
permissions:
|
|
|
contents: write
|
|
|
|