Skip to content

cherry-pick(release/v1.207): run a package with no project in the default project (#4630) #12744

cherry-pick(release/v1.207): run a package with no project in the default project (#4630)

cherry-pick(release/v1.207): run a package with no project in the default project (#4630) #12744

Workflow file for this run

name: CLI Verb Gate
# Per-skill gate that fails when a PR introduces (or leaves) `uip <verb>`
# references in skill markdown that don't resolve against the current CLI
# catalog (`assets/uip-catalog-snapshot.json`). Scoped exactly like
# smoke-skills.yml and activation-gate.yml: only the skills touched by the
# PR are checked, so the existing doc-drift backlog is swept opportunistically
# as each skill is next edited rather than blocking unrelated PRs.
concurrency:
group: verb-gate-${{ github.head_ref || github.ref }}
# Only `synchronize` moves the head SHA; every other pull_request event can
# fire on a commit a run is already in flight for, and the cancelled run
# reports the required `CLI verb gate` context as `cancelled`. See
# docs/REQUIRED-CHECKS.md Rule 3a.
cancel-in-progress: ${{ github.event.action == 'synchronize' }}
on:
# No `paths:` filter — this is wired as a required check. detect short-
# circuits via skip=true when nothing relevant changed; GitHub reports the
# gated job as skipped, which counts as a pass for required checks. Same
# rationale as smoke-skills.yml.
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
detect:
runs-on: uipath-ubuntu-latest
# Qualified with the workflow name on purpose: smoke-skills.yml has a
# `detect` job named `Detect changed skills` too, and two jobs sharing one
# check name make any required context matching it ambiguous. smoke-skills
# keeps the bare name (its sibling `Run skill smoke tests` is already
# required and referenced by that name elsewhere); this one is qualified.
name: Detect changed skills (CLI verb gate)
outputs:
skills: ${{ steps.detect.outputs.skills }}
skip: ${{ steps.detect.outputs.skip }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with: { fetch-depth: 0 }
- id: detect
env:
BASE_REF: ${{ github.base_ref || 'main' }}
run: |
set -euo pipefail
BASE_SHA=$(git merge-base "origin/$BASE_REF" HEAD)
CHANGED=$(git diff --name-only "$BASE_SHA"...HEAD)
# Infrastructure edits (catalog refresh, checker script, this
# workflow) re-gate every skill — same pattern as smoke-skills.yml's
# "test infrastructure changed → run everything" branch.
# Every tree that exists is gated, and the matrix carries the full
# PATH rather than a bare name — `preview/` skills and a `classic/`
# tree a flavor pins are markdown that names `uip` verbs exactly
# like `skills/` ones, and a retired verb rots the same way in any
# of them. A tree may be absent (`classic/` was deleted in #4193),
# so check each one instead of globbing all three into `ls`, which
# exits 2 on a missing path and failed this job under pipefail.
if echo "$CHANGED" | grep -qE '^(assets/uip-catalog-snapshot\.json|scripts/check-skill-verbs\.py|\.github/workflows/verb-gate\.yml)$'; then
SKILLS=$(for tree in skills preview/skills classic/skills; do
for dir in "$tree"/*/; do
if [ -d "$dir" ]; then echo "${dir%/}"; fi
done
done | sort -u)
# Re-gating everything must find something; an empty list would
# report "no skill markdown changes" and skip the gate.
if [ -z "$SKILLS" ]; then
echo "::error::No skill directories found under skills/, preview/skills/ or classic/skills/."
exit 1
fi
else
SKILLS=$(echo "$CHANGED" \
| grep -E '^(skills|preview/skills|classic/skills)/[^/]+/.*\.md$' \
| sed -E 's#^((skills|preview/skills|classic/skills)/[^/]+)/.*#\1#' \
| sort -u || true)
fi
if [ -z "$SKILLS" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "No skill markdown changes — gate not triggered."
exit 0
fi
JSON=$(printf '%s\n' $SKILLS | jq -R . | jq -s -c .)
echo "skills=$JSON" >> "$GITHUB_OUTPUT"
echo "Will gate: $SKILLS"
gate:
needs: detect
if: needs.detect.outputs.skip != 'true'
runs-on: uipath-ubuntu-latest
name: ${{ matrix.skill }}
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
skill: ${{ fromJSON(needs.detect.outputs.skills) }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with: { python-version: '3.13' }
- name: Check verbs in ${{ matrix.skill }}
env:
SKILL: ${{ matrix.skill }}
run: |
set -euo pipefail
# No `|| true`: in --json mode the checker returns 0 unconditionally
# (scripts/check-skill-verbs.py), so findings are graded by the jq
# counts below, not by exit status. Swallowing the exit status only
# ever hid a real crash — a missing or malformed catalog, an argparse
# error, an unhandled exception — which then produced an empty
# findings.ndjson, zero counts, and a green leg that checked nothing.
python3 scripts/check-skill-verbs.py --json "$SKILL" > findings.ndjson
# Block only on Stale findings where no valid catalog prefix
# matched at all. When matched_prefix is non-null, the trailing
# tokens are typically positional argument values (file paths,
# registry keys, names) that the literal-walker can't distinguish
# from sub-verbs — surface those as warnings, not hard failures.
BLOCKING=$(jq -c 'select(.severity=="Stale" and .matched_prefix == null)' findings.ndjson | wc -l | tr -d ' ')
SOFT=$(jq -c 'select(.severity=="Stale" and .matched_prefix != null)' findings.ndjson | wc -l | tr -d ' ')
UNCERTAIN=$(grep -c '"severity": "Uncertain"' findings.ndjson || true)
echo "$SKILL: $BLOCKING blocking, $SOFT soft-stale, ${UNCERTAIN:-0} Uncertain"
if [ "$SOFT" -gt 0 ]; then
echo "::group::Soft-stale verbs in $SKILL (valid prefix, suspicious tail)"
jq -r 'select(.severity=="Stale" and .matched_prefix != null) | "::warning file=\(.path),line=\(.line)::Possibly stale `uip \(.verb_path)` (valid prefix: `\(.matched_prefix)`)"' findings.ndjson
echo "::endgroup::"
fi
if [ "$BLOCKING" -gt 0 ]; then
echo "::group::Stale verbs in $SKILL"
jq -r 'select(.severity=="Stale" and .matched_prefix == null) | "::error file=\(.path),line=\(.line)::Stale verb `uip \(.verb_path)`"' findings.ndjson
echo "::endgroup::"
echo
echo 'Fix: replace each `uip <verb>` above with a verb that exists in the current CLI'
echo "(see assets/uip-catalog-snapshot.json) or remove the reference."
exit 1
fi
# Fixed-name aggregator. The `gate` job above is named `${{ matrix.skill }}`,
# so its check name changes with every skill added or renamed. Required-
# status-check contexts are literal strings, so a matrix leg can never be
# required: a name that doesn't run leaves the context pending forever. This
# job's name is constant, so require THIS one. It rolls up `detect` + every
# `gate` leg into a single pass/fail.
gate-summary:
name: CLI verb gate
needs: [detect, gate]
# Runs whatever `detect` and `gate` did, so the required context always
# reports; the rollup below is what turns their results into pass/fail.
# `!cancelled()` rather than `always()`, and the `${{ }}` wrapper is
# required (bare `!` starts a YAML tag) — docs/REQUIRED-CHECKS.md
# § Why `!cancelled()` and not `always()`.
if: ${{ !cancelled() }}
runs-on: uipath-ubuntu-latest
timeout-minutes: 5
steps:
- name: Roll up gate results
# Job results via env, not inline ${{ }} in run: — these are workflow-
# controlled values, but the repo keeps every interpolation out of the
# shell body regardless.
env:
DETECT_RESULT: ${{ needs.detect.result }}
GATE_RESULT: ${{ needs.gate.result }}
run: |
set -euo pipefail
echo "detect=$DETECT_RESULT gate=$GATE_RESULT"
# `needs.<matrix job>.result` is already the rollup of every leg:
# 'success' only when all legs succeeded, 'failure' when any failed.
# 'skipped' is the healthy no-op path and must pass.
#
# ALLOW-list the two good values rather than deny-listing the two bad
# ones. This is the repo's merge gate: an empty result, or a value
# GitHub adds later, must fail closed rather than fall through to
# "passed".
for result in "$DETECT_RESULT" "$GATE_RESULT"; do
case "$result" in
success|skipped) ;;
failure|cancelled) ;;
*) echo "::error::unrecognized job result '$result' — failing closed"; exit 1 ;;
esac
done
if [ "$DETECT_RESULT" = "failure" ] || [ "$DETECT_RESULT" = "cancelled" ]; then
echo "::error::CLI verb gate could not determine which skills to gate (detect: $DETECT_RESULT)"
exit 1
fi
if [ "$GATE_RESULT" = "failure" ] || [ "$GATE_RESULT" = "cancelled" ]; then
echo "::error::at least one CLI verb gate leg failed — see the per-skill jobs above"
exit 1
fi
echo "CLI verb gate passed."