From 5e7bbaee998f3ae111e6a6182e4eab118492ad34 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:39:29 +0000 Subject: [PATCH 1/2] Initial plan From 541e583749adac57dc29c0d097491db2b45f9ead Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:56:35 +0000 Subject: [PATCH 2/2] docs: fix custom trigger filtering - replace exit 1 with job-based graceful skip pattern Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../guides/deterministic-agentic-patterns.md | 64 +++++++++++++++---- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/docs/src/content/docs/guides/deterministic-agentic-patterns.md b/docs/src/content/docs/guides/deterministic-agentic-patterns.md index b601defd048..d08733e48dd 100644 --- a/docs/src/content/docs/guides/deterministic-agentic-patterns.md +++ b/docs/src/content/docs/guides/deterministic-agentic-patterns.md @@ -94,28 +94,70 @@ Pass data between jobs via artifacts, job outputs, or environment variables. ## Custom Trigger Filtering +Use a deterministic job to compute whether the agent should run, expose the result as a job output, and reference it with `if:`. The compiler automatically adds the filter job as a dependency of the activation job, so when the condition is false the workflow run is **skipped** (not failed), keeping the Actions tab clean. + ```yaml wrap title=".github/workflows/smart-responder.md" --- on: issues: - types: [opened, edited] + types: [opened] engine: copilot safe-outputs: add-comment: -steps: - - id: filter - run: | - if echo "${{ github.event.issue.body }}" | grep -q "urgent"; then - echo "priority=high" >> "$GITHUB_OUTPUT" - else - exit 1 - fi +jobs: + filter: + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.check.outputs.result }} + steps: + - id: check + env: + LABELS: ${{ toJSON(github.event.issue.labels.*.name) }} + run: | + if echo "$LABELS" | grep -q '"bug"'; then + echo "result=true" >> "$GITHUB_OUTPUT" + else + echo "result=false" >> "$GITHUB_OUTPUT" + fi + +if: needs.filter.outputs.should-run == 'true' +--- + +# Bug Issue Responder + +Triage bug report: "${{ github.event.issue.title }}" and add-comment with a summary of the next steps. +``` + +When `should-run` is `false`, GitHub marks the dependent jobs as **skipped** rather than failed, so no red X appears in the Actions tab and the Workflow Failure issue mechanism is not triggered. + +### Simple Context Conditions + +For conditions that can be expressed directly with GitHub Actions context, use `if:` without a custom job: + +```yaml wrap --- +on: + pull_request: + types: [opened, synchronize] +engine: copilot +if: github.event.pull_request.draft == false +--- +``` + +### Query-Based Filtering -# Smart Issue Responder +For conditions based on GitHub search results, use [`skip-if-match:`](/gh-aw/reference/triggers/#skip-if-match-condition-skip-if-match) or [`skip-if-no-match:`](/gh-aw/reference/triggers/#skip-if-no-match-condition-skip-if-no-match) in the `on:` section — these accept standard [GitHub search query syntax](https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests) and are evaluated in the pre-activation job, producing the same skipped-not-failed behaviour: -Respond to urgent issue: "${{ github.event.issue.title }}" (Priority: ${{ steps.filter.outputs.priority }}) +```yaml wrap +--- +on: + issues: + types: [opened] + # Skip if a duplicate issue already exists (GitHub search query syntax) + skip-if-match: 'is:issue is:open label:duplicate' +engine: copilot +--- ``` ## Post-Processing Pattern