-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.yaml
102 lines (95 loc) · 4.38 KB
/
action.yaml
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
name: Trunk Compute Impacted Targets
author: trunk.io
description: Trunk.io Github Action to Compute and Upload Impacted Targets
inputs:
trunk-token:
description:
Repo or Organization API token used for authentication. Can be found at app.trunk.io.
required: false # Required for any workflow not coming from a forked PR.
target-branch:
description:
The branch that the Merge Queue merges PRs into. If unspecified, defaults to the repository's
default branch.
required: false
bazel-workspace-path:
description:
The path to the bazel WORKSPACE, relative to the root of the git repository. If unspecified,
defaults to the root of the repository.
required: false
verbose:
description: Whether to enable verbose logging. Defaults to false.
required: false
bazel-startup-options:
description:
A comma separated list of startup options to pass to Bazel. See
https://bazel.build/reference/command-line-reference#startup-options for a complete list. If
unspecified, no startup options are specified.
required: false
bazel-path:
description: A path to the Bazel executable. Defaults to PATH.
required: false
default: bazel
impact-all-filters-path:
description:
A path to a list of filters to identify whether `ALL` impacted targets should be considered.
See https://github.com/dorny/paths-filter/blob/master/.github/filters.yml for an example. If a
PR changes files in any of these paths, then *any* PRs queued after this one will depend on
it.
required: false
default: ""
runs:
using: composite
steps:
- name: Detect changed paths
id: detect-changed-paths
if: ${{ inputs.impact-all-filters-path != '' }}
# trunk-ignore(semgrep/yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha)
uses: dorny/paths-filter@v2
with:
filters: ${{ inputs.impact-all-filters-path }}
- name: Prerequisites
id: prerequisites
run: ${GITHUB_ACTION_PATH}/src/scripts/prerequisites.sh
shell: bash
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
TARGET_BRANCH: ${{ inputs.target-branch }}
PR_BRANCH_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
WORKSPACE_PATH: ${{ inputs.bazel-workspace-path }}
BAZEL_PATH: ${{ inputs.bazel-path }}
IMPACTS_FILTERS_CHANGES: ${{ steps.detect-changed-paths.outputs.changes }}
- name: Setup jq
# trunk-ignore(semgrep): Trust third-party action to install JQ. Source code: https://github.com/dcarbone/install-jq-action/
uses: dcarbone/[email protected]
- name: Install Bazel in PATH
if: ${{ steps.prerequisites.outputs.requires_default_bazel_installation == 'true' }}
# trunk-ignore(semgrep): Trust third-party `bazelbuild` GH Action
uses: bazelbuild/setup-bazelisk@v2
- name: Compute Impacted Targets
id: compute-impacted-targets
run: ${GITHUB_ACTION_PATH}/src/scripts/compute_impacted_targets.sh
if: ${{ steps.prerequisites.outputs.impacts_all_detected == 'false' }}
shell: bash
env:
MERGE_INSTANCE_BRANCH: ${{ steps.prerequisites.outputs.merge_instance_branch }}
MERGE_INSTANCE_BRANCH_HEAD_SHA:
${{ steps.prerequisites.outputs.merge_instance_branch_head_sha }}
PR_BRANCH_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
VERBOSE: ${{ inputs.verbose }}
WORKSPACE_PATH: ${{ steps.prerequisites.outputs.workspace_path }}
BAZEL_PATH: ${{ inputs.bazel-path }}
BAZEL_STARTUP_OPTIONS: ${{ inputs.bazel-startup-options }}
- name: Upload Impacted Targets
run: ${GITHUB_ACTION_PATH}/src/scripts/upload_impacted_targets.sh
shell: bash
env:
ACTOR: ${{ github.actor }}
API_TOKEN: ${{ inputs.trunk-token }}
REPOSITORY: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
IS_FORK: ${{ github.event.pull_request.head.repo.fork }}
TARGET_BRANCH: ${{ steps.prerequisites.outputs.merge_instance_branch }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_BRANCH_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
IMPACTED_TARGETS_FILE: ${{ steps.compute-impacted-targets.outputs.impacted_targets_out }}
IMPACTS_ALL_DETECTED: ${{ steps.prerequisites.outputs.impacts_all_detected }}