Skip to content

Commit 9c84445

Browse files
authored
Merge branch 'main' into new-product-query
2 parents 249e236 + 103c08c commit 9c84445

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2394
-1024
lines changed

.github/REUSABLE_WORKFLOWS.md

Lines changed: 242 additions & 112 deletions
Large diffs are not rendered by default.

.github/actions/detect-relevant-changes/action.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ inputs:
2121
required: false
2222
default: ""
2323
type-pattern-add:
24-
description: "Additional type-to-glob mappings (comma or newline separated, e.g. cpp:*.cc). '.in' variants are added automatically."
24+
description: >-
25+
Additional type-to-glob mappings (comma or newline separated, e.g. cpp:*.cc). '.in' variants are added
26+
automatically.
2527
required: false
2628
default: ""
2729
outputs:
@@ -44,6 +46,7 @@ runs:
4446
FILE_TYPE: ${{ inputs.file-type }}
4547
INCLUDE_GLOBS: ${{ inputs.include-globs }}
4648
TYPE_PATTERN_ADD: ${{ inputs.type-pattern-add }}
49+
# yamllint disable rule:line-length
4750
run: |
4851
set -euo pipefail
4952
@@ -55,9 +58,11 @@ runs:
5558
DEFAULT_TYPE_PATTERNS[python]=$'*.py'
5659
DEFAULT_TYPE_PATTERNS[md]=$'*.md'
5760
DEFAULT_TYPE_PATTERNS[jsonnet]=$'*.jsonnet\n*.libsonnet'
61+
DEFAULT_TYPE_PATTERNS[yaml]=$'*.yaml\n*.yml'
5862
# Types that do not support .in variants for relevance detection
5963
declare -A NO_IN_VARIANT_TYPES
6064
NO_IN_VARIANT_TYPES[jsonnet]="1"
65+
NO_IN_VARIANT_TYPES[yaml]="1"
6166
6267
parse_list() {
6368
local input="$1"
@@ -208,3 +213,4 @@ runs:
208213
echo "matched=false" >> "$GITHUB_OUTPUT"
209214
echo "matched_files=" >> "$GITHUB_OUTPUT"
210215
fi
216+
# yamllint enable

.github/actions/handle-fix-commit/action.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ inputs:
3939
description: "The number of times to retry pushing the commit."
4040
required: false
4141
default: "6"
42+
skip-comment:
43+
description: "Skip posting PR comments (for workflow_call usage)"
44+
required: false
45+
default: "false"
4246

4347
runs:
4448
using: "composite"
@@ -55,25 +59,36 @@ runs:
5559
fi
5660
5761
- name: No changes to apply
58-
if: steps.check_changes.outputs.changes == 'false' && github.event.pull_request.number
62+
if: steps.check_changes.outputs.changes == 'false' && inputs.skip-comment != 'true'
5963
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
6064
with:
6165
message: "No automatic ${{ inputs.tool }} fixes were necessary."
6266

6367
- name: Get PR maintainer_can_modify property
6468
id: pr-properties
65-
if: steps.check_changes.outputs.changes == 'true' && github.event.pull_request.number
69+
if: steps.check_changes.outputs.changes == 'true'
6670
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
6771
with:
6872
script: |
73+
// context.issue.number is only available when the root trigger is an
74+
// issue_comment event. For workflow_dispatch triggers (and any other
75+
// non-PR-comment trigger), default to false so the commit path still
76+
// works for same-repo pushes via the first clause of the commit condition.
77+
const prNumber = context.issue.number;
78+
if (!prNumber) {
79+
core.setOutput('maintainer_can_modify', 'false');
80+
return;
81+
}
6982
const { data: pr } = await github.rest.pulls.get({
7083
owner: context.repo.owner,
7184
repo: context.repo.repo,
72-
pull_number: context.issue.number
85+
pull_number: prNumber
7386
});
7487
core.setOutput('maintainer_can_modify', pr.maintainer_can_modify);
7588
- name: Commit fixes
76-
if: steps.check_changes.outputs.changes == 'true' && (inputs.pr-info-repo == github.repository || steps.pr-properties.outputs.maintainer_can_modify == 'true')
89+
if: >-
90+
steps.check_changes.outputs.changes == 'true' && (inputs.pr-info-repo == github.repository ||
91+
steps.pr-properties.outputs.maintainer_can_modify == 'true')
7792
id: commit_and_push
7893
shell: bash
7994
working-directory: ${{ inputs.working-directory }}
@@ -123,15 +138,21 @@ runs:
123138
exit 1
124139
125140
- name: Notify of commit
126-
if: steps.commit_and_push.conclusion == 'success' && steps.commit_and_push.outputs.pushed == 'true' && github.event.pull_request.number
141+
if:
142+
steps.commit_and_push.conclusion == 'success' && steps.commit_and_push.outputs.pushed == 'true' &&
143+
inputs.skip-comment != 'true'
127144
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
128145
with:
146+
# yamllint disable rule:line-length
129147
message: |
130148
Automatic ${{ inputs.tool }} fixes pushed (commit ${{ steps.commit_and_push.outputs.commit_sha_short || steps.commit_and_push.outputs.commit_sha }}).
131149
⚠️ **Note:** Some issues may require manual review and fixing.
150+
# yamllint enable
132151

133152
- name: Create patch
134-
if: steps.check_changes.outputs.changes == 'true' && inputs.pr-info-repo != github.repository && steps.pr-properties.outputs.maintainer_can_modify != 'true'
153+
if: >-
154+
steps.check_changes.outputs.changes == 'true' && inputs.pr-info-repo != github.repository &&
155+
steps.pr-properties.outputs.maintainer_can_modify != 'true'
135156
id: create_patch
136157
shell: bash
137158
working-directory: ${{ inputs.working-directory }}
@@ -147,9 +168,10 @@ runs:
147168
path: ${{ inputs.working-directory }}/${{ steps.create_patch.outputs.patch_name }}
148169

149170
- name: Comment with patch instructions
150-
if: steps.create_patch.outputs.patch_name && github.event.pull_request.number
171+
if: steps.create_patch.outputs.patch_name && inputs.skip-comment != 'true'
151172
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
152173
with:
174+
# yamllint disable rule:line-length
153175
message: |
154176
Automatic fixes are available but could not be applied directly because this PR is from a fork and "Allow edits from maintainers" is not enabled.
155177
Please apply the patch below to fix the issues:
@@ -162,3 +184,4 @@ runs:
162184
```bash
163185
git commit -am "Apply ${{ inputs.tool }} fixes"
164186
```
187+
# yamllint enable

.github/workflows/actionlint-check.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ permissions:
55
contents: read
66
pull-requests: read
77

8-
on:
8+
"on":
99
pull_request:
1010
workflow_dispatch:
1111
inputs:
@@ -42,16 +42,22 @@ on:
4242
type: string
4343

4444
env:
45-
local_checkout_path: ${{ (github.event_name == 'workflow_call' && inputs.checkout-path) || format('{0}-src', github.event.repository.name) }}
45+
local_checkout_path:
46+
${{ (github.event_name == 'workflow_call' && inputs.checkout-path) || format('{0}-src',
47+
github.event.repository.name) }}
4648

4749
jobs:
4850
pre-check:
4951
runs-on: ubuntu-latest
5052
outputs:
5153
is_act: ${{ steps.detect_act.outputs.is_act }}
52-
ref: ${{ (github.event_name == 'workflow_call' && inputs.ref) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.ref || github.ref)) || github.sha }}
54+
ref:
55+
${{ (github.event_name == 'workflow_call' && inputs.ref) || (github.event_name == 'workflow_dispatch' &&
56+
(github.event.inputs.ref || github.ref)) || github.sha }}
5357
repo: ${{ (github.event_name == 'workflow_call' && inputs.repo) || github.repository }}
54-
base_sha: ${{ (github.event_name == 'workflow_call' && inputs.pr-base-sha) || github.event.pull_request.base.sha || github.event.before }}
58+
base_sha:
59+
${{ (github.event_name == 'workflow_call' && inputs.pr-base-sha) || github.event.pull_request.base.sha ||
60+
github.event.before }}
5561
steps:
5662
- name: Detect act environment
5763
id: detect_act
@@ -60,12 +66,10 @@ jobs:
6066
detect-changes:
6167
needs: pre-check
6268
if: >
63-
github.event_name != 'workflow_dispatch' &&
64-
(
69+
github.event_name != 'workflow_dispatch' && (
6570
github.event_name != 'workflow_call' ||
6671
(inputs.skip-relevance-check != 'true' && github.event.inputs == null && github.event.comment == null)
67-
) &&
68-
needs.pre-check.outputs.is_act != 'true'
72+
) && needs.pre-check.outputs.is_act != 'true'
6973
runs-on: ubuntu-latest
7074
permissions:
7175
contents: read
@@ -107,8 +111,7 @@ jobs:
107111
actionlint-check:
108112
needs: [pre-check, detect-changes]
109113
if: >
110-
always() &&
111-
(
114+
always() && (
112115
needs.detect-changes.result == 'skipped' ||
113116
(
114117
needs.detect-changes.result == 'success' &&
@@ -153,14 +156,11 @@ jobs:
153156
actionlint-check-skipped:
154157
needs: [pre-check, detect-changes]
155158
if: >
156-
needs.pre-check.result == 'success' &&
157-
github.event_name != 'workflow_dispatch' &&
158-
(
159+
needs.pre-check.result == 'success' && github.event_name != 'workflow_dispatch' && (
159160
github.event_name != 'workflow_call' ||
160161
(inputs.skip-relevance-check != 'true' && github.event.inputs == null && github.event.comment == null)
161-
) &&
162-
needs.pre-check.outputs.is_act != 'true' &&
163-
(needs.detect-changes.result == 'success' && needs.detect-changes.outputs.has_changes != 'true')
162+
) && needs.pre-check.outputs.is_act != 'true' && (needs.detect-changes.result == 'success' &&
163+
needs.detect-changes.outputs.has_changes != 'true')
164164
runs-on: ubuntu-latest
165165
permissions:
166166
contents: read

.github/workflows/add-issues.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Add issues to issues project
22

3-
on:
3+
"on":
44
issues:
55
types:
66
- opened

.github/workflows/clang-format-check.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ permissions:
55
contents: read
66
pull-requests: read
77

8-
on:
8+
"on":
99
pull_request:
1010
workflow_dispatch:
1111
inputs:
@@ -30,8 +30,7 @@ jobs:
3030
detect-changes:
3131
needs: pre-check
3232
if: >
33-
github.event_name != 'workflow_dispatch' &&
34-
needs.pre-check.outputs.is_act != 'true'
33+
github.event_name != 'workflow_dispatch' && needs.pre-check.outputs.is_act != 'true'
3534
runs-on: ubuntu-latest
3635
permissions:
3736
contents: read
@@ -69,8 +68,7 @@ jobs:
6968
clang-format-check:
7069
needs: [pre-check, detect-changes]
7170
if: >
72-
always() &&
73-
(
71+
always() && (
7472
needs.detect-changes.result == 'skipped' ||
7573
(
7674
needs.detect-changes.result == 'success' &&
@@ -115,10 +113,8 @@ jobs:
115113
clang-format-check-skipped:
116114
needs: [pre-check, detect-changes]
117115
if: >
118-
github.event_name != 'workflow_dispatch' &&
119-
needs.pre-check.outputs.is_act != 'true' &&
120-
needs.detect-changes.result == 'success' &&
121-
needs.detect-changes.outputs.has_changes != 'true'
116+
github.event_name != 'workflow_dispatch' && needs.pre-check.outputs.is_act != 'true' &&
117+
needs.detect-changes.result == 'success' && needs.detect-changes.outputs.has_changes != 'true'
122118
runs-on: ubuntu-latest
123119
permissions:
124120
contents: read

0 commit comments

Comments
 (0)