-
Notifications
You must be signed in to change notification settings - Fork 13
127 lines (121 loc) · 5.83 KB
/
ci_changes.yml
File metadata and controls
127 lines (121 loc) · 5.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Changes
on:
workflow_call:
inputs:
pr_info:
description: 'The JSON string containing the PR information'
required: true
type: string
full_ci:
description: 'Whether to run the full CI matrix without path filtering'
required: false
default: false
type: boolean
ref_name:
description: 'The ref name from the triggering workflow'
required: true
type: string
default_branch:
description: 'The repository default branch used as the fallback comparison base'
required: true
type: string
outputs:
base:
description: 'The comparison base used for filtered checks'
value: ${{ jobs.changes.outputs.base }}
run_dependencies:
description: 'Whether dependency-license checks should run'
value: ${{ jobs.changes.outputs.run_dependencies }}
run_docs:
description: 'Whether documentation jobs should run'
value: ${{ jobs.changes.outputs.run_docs }}
run_go:
description: 'Whether Go jobs should run'
value: ${{ jobs.changes.outputs.run_go }}
run_node:
description: 'Whether Node.js jobs should run'
value: ${{ jobs.changes.outputs.run_node }}
run_node_package:
description: 'Whether Node.js packaging jobs should run'
value: ${{ jobs.changes.outputs.run_node_package }}
run_openclaw:
description: 'Whether OpenClaw integration jobs should run'
value: ${{ jobs.changes.outputs.run_openclaw }}
run_python:
description: 'Whether Python jobs should run'
value: ${{ jobs.changes.outputs.run_python }}
run_python_package:
description: 'Whether Python packaging jobs should run'
value: ${{ jobs.changes.outputs.run_python_package }}
run_rust:
description: 'Whether Rust jobs should run'
value: ${{ jobs.changes.outputs.run_rust }}
run_rust_package:
description: 'Whether Rust packaging jobs should run'
value: ${{ jobs.changes.outputs.run_rust_package }}
run_wasm:
description: 'Whether WebAssembly jobs should run'
value: ${{ jobs.changes.outputs.run_wasm }}
run_wasm_package:
description: 'Whether WebAssembly packaging jobs should run'
value: ${{ jobs.changes.outputs.run_wasm_package }}
jobs:
changes:
name: Detect
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
outputs:
base: ${{ steps.comparison-base.outputs.base }}
run_dependencies: ${{ inputs.full_ci || steps.filter.outputs.dependencies == 'true' }}
run_docs: ${{ (inputs.full_ci || startsWith(inputs.ref_name, 'pull-request/')) && (inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.shared == 'true' || steps.filter.outputs.docs == 'true') }}
run_go: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.shared == 'true' || steps.filter.outputs.go == 'true' }}
run_node: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.shared == 'true' || steps.filter.outputs.node == 'true' || steps.filter.outputs.openclaw == 'true' }}
run_node_package: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.node_package == 'true' }}
run_openclaw: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.shared == 'true' || steps.filter.outputs.node == 'true' || steps.filter.outputs.openclaw == 'true' }}
run_python: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.shared == 'true' || steps.filter.outputs.python == 'true' }}
run_python_package: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.python_package == 'true' }}
run_rust: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.shared == 'true' || steps.filter.outputs.rust == 'true' }}
run_rust_package: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.rust_package == 'true' }}
run_wasm: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.shared == 'true' || steps.filter.outputs.wasm == 'true' }}
run_wasm_package: ${{ inputs.full_ci || steps.filter.outputs.ci == 'true' || steps.filter.outputs.wasm_package == 'true' }}
steps:
- name: Checkout
if: ${{ ! inputs.full_ci }}
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Resolve comparison base
id: comparison-base
if: ${{ ! inputs.full_ci }}
env:
DEFAULT_BRANCH: ${{ inputs.default_branch }}
EVENT_BEFORE: ${{ github.event.before }}
PR_INFO: ${{ inputs.pr_info }}
REF_NAME: ${{ inputs.ref_name }}
run: |
set -euo pipefail
base=""
if [[ "$REF_NAME" == pull-request/* ]]; then
if [[ -n "$PR_INFO" ]]; then
base="$(jq -r '.base.ref // empty' <<< "$PR_INFO")"
fi
if [[ -z "$base" ]]; then
base="${DEFAULT_BRANCH}"
fi
elif [[ -n "$EVENT_BEFORE" && "$EVENT_BEFORE" != "0000000000000000000000000000000000000000" ]]; then
base="$EVENT_BEFORE"
else
base="${DEFAULT_BRANCH}"
fi
printf 'base=%s\n' "$base" >> "$GITHUB_OUTPUT"
- name: Detect changed paths
id: filter
if: ${{ ! inputs.full_ci }}
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.01
with:
base: ${{ steps.comparison-base.outputs.base }}
filters: .github/ci-path-filters.yml