Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/skip-if-query-api-routing.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .github/aw/syntax-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ The YAML frontmatter supports these fields:

- Query is automatically scoped to the current repository (use `scope: none` for cross-repo queries)
- Use to gate workflows on preconditions (e.g., only run if open PRs exist)
- **Efficient skip-if queries**: prefer the subset evaluated via GraphQL/REST instead of the rate-limited search API (30 req/min):
- Allowed: `is:`/`type:`/`state:` (`issue`, `pr`, `open`, `closed`, `merged`), `label:` (one or more, AND), `author:`, `assignee:`, `mentions:` (plain logins), `sort:`
- Must stay scoped to one repository (default scope; not `scope: none`)
- Falls back to search: free text, `in:title`/`in:body`, negation (`-label:`), comma label lists (`label:a,b`), `org:`, `@me`, other qualifiers
- Prefer a marker label (`is:issue is:open label:my-workflow`) over title/body text matching when designing dedup gates
- **`skip-if-check-failing:`** - Skip workflow execution when CI checks are failing on the triggering ref (boolean or object)
- Boolean format: `skip-if-check-failing: true` (skip if any check is failing or pending)
- Object format with filtering:
Expand Down
11 changes: 4 additions & 7 deletions actions/setup/js/check_skip_if_helpers.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const { getErrorMessage } = require("./error_helpers.cjs");
const { ERR_API, ERR_CONFIG } = require("./error_codes.cjs");
const { writeDenialSummary } = require("./pre_activation_summary.cjs");
const { countSearchMatches } = require("./skip_if_query.cjs");

/**
* Builds the GitHub search query, optionally scoping it to the current repository.
Expand Down Expand Up @@ -74,14 +75,10 @@ async function runSkipQueryGate(options) {
const searchQuery = buildSearchQuery(skipQuery, skipScope);

try {
const {
data: { total_count: totalCount },
} = await github.rest.search.issuesAndPullRequests({
q: searchQuery,
per_page: 1,
});
const { totalCount, exact, backend } = await countSearchMatches(searchQuery, threshold);

core.info(`Search found ${totalCount} matching items`);
core.info(`Evaluated query via ${backend} API`);
core.info(`Search found ${exact ? "" : "at least "}${totalCount} matching items`);
Comment thread
pelikhan marked this conversation as resolved.
Resolved

if (shouldSkip(totalCount, threshold)) {
core.warning(warningMessage(totalCount, threshold));
Expand Down
Loading
Loading