Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ on:
branches: [ dev ]
pull_request:
branches: [ dev ]
workflow_dispatch:
inputs:
ref:
description: 'Branch or ref to build/test'
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.ref }}
cancel-in-progress: true

env:
Expand All @@ -22,12 +28,14 @@ jobs:
pull-requests: read
runs-on: ubuntu-latest
outputs:
code_changes: ${{ steps.filter.outputs.code_changes }}
code_changes: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.code_changes }}
steps:
- uses: actions/checkout@v4
if: github.event_name != 'workflow_dispatch'

- name: Detect build-relevant changes
id: filter
if: github.event_name != 'workflow_dispatch'
uses: dorny/paths-filter@v4
with:
filters: |
Expand All @@ -50,6 +58,8 @@ jobs:
needs: changes
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Skip build for workflow-only changes
if: needs.changes.outputs.code_changes != 'true'
Expand Down Expand Up @@ -87,6 +97,8 @@ jobs:
needs: [changes, build]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Skip unit tests for workflow-only changes
if: needs.changes.outputs.code_changes != 'true'
Expand All @@ -112,6 +124,8 @@ jobs:
needs: [changes, unit-test]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Skip integration tests for workflow-only changes
if: needs.changes.outputs.code_changes != 'true'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/opencode-test-writer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,15 @@

- name: Trigger downstream workflows
if: steps.check-existing.outputs.skip != 'true'
run: |

Check warning on line 231 in .github/workflows/opencode-test-writer.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:7:55: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: i:.github/workflows/opencode-test-writer.yml:231:9: shellcheck reported issue in this script: SC2086:info:7:55: Double quote to prevent globbing and word splitting [shellcheck]

Check warning on line 231 in .github/workflows/opencode-test-writer.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:6:52: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: i:.github/workflows/opencode-test-writer.yml:231:9: shellcheck reported issue in this script: SC2086:info:6:52: Double quote to prevent globbing and word splitting [shellcheck]
sleep 5
PR_NUM=$(gh pr list --base dev --head "opencode/dispatch-" --label automated-test --state open --json number --jq '.[0].number')
BRANCH="${{ steps.select-module.outputs.branch }}"
PR_NUM=$(gh pr list --base dev --head "$BRANCH" --label automated-test --state open --json number --jq '.[0].number')
if [ -n "$PR_NUM" ]; then
echo "Triggering Build and opencode review for PR #$PR_NUM"
SHA=$(gh api repos/OpenStaticFish/ZigCraft/pulls/$PR_NUM --jq '.head.sha')
gh workflow run build.yml --field ref="opencode/dispatch-" || echo "Build trigger attempted"
BRANCH=$(gh api repos/OpenStaticFish/ZigCraft/pulls/$PR_NUM --jq '.head.ref')
gh workflow run build.yml --field ref="$BRANCH" || echo "Build trigger attempted"
gh workflow run opencode-pr.yml --field pr_number="$PR_NUM" --field head_sha="$SHA"
else
echo "No PR found to trigger workflows"
Expand Down
Loading