-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support an Impacts All PATH Filter (#39)
- Move the sha computation into `prerequisites`. - If any paths are added/removed/modified via [dorny's path filter](https://github.com/dorny/paths-filter), skip impacted target computation and upload `ALL`. Tested using `netkos/act` against a temporary merge graph in staging: https://www.loom.com/share/Library-or-Loom-14-September-2023-4edd8ed7f45240718f4180a3543585dc Closes https://linear.app/trunk/issue/TRUNK-8676/support-wildcard-impacted-target
- Loading branch information
1 parent
6c5a6fc
commit 6a6b856
Showing
6 changed files
with
127 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,36 +29,56 @@ inputs: | |
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. | ||
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: ${{ github.head_ref }} | ||
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: 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: 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 }} | ||
PR_BRANCH: ${{ github.head_ref }} | ||
MERGE_INSTANCE_BRANCH_HEAD_SHA: | ||
${{ steps.prerequisites.outputs.merge_instance_branch_head_sha }} | ||
PR_BRANCH: ${{ steps.prerequisites.outputs.pr_branch }} | ||
PR_BRANCH_HEAD_SHA: ${{ steps.prerequisites.outputs.pr_branch_head_sha }} | ||
VERBOSE: ${{ inputs.verbose }} | ||
WORKSPACE_PATH: ${{ steps.prerequisites.outputs.workspace_path }} | ||
BAZEL_PATH: ${{ inputs.bazel-path }} | ||
|
@@ -73,5 +93,6 @@ runs: | |
REPOSITORY: ${{ github.repository }} | ||
TARGET_BRANCH: ${{ steps.prerequisites.outputs.merge_instance_branch }} | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
PR_SHA: ${{ steps.compute-impacted-targets.outputs.git_commit }} | ||
PR_SHA: ${{ steps.prerequisites.outputs.pr_branch_head_sha }} | ||
IMPACTED_TARGETS_FILE: ${{ steps.compute-impacted-targets.outputs.impacted_targets_out }} | ||
IMPACTS_ALL_DETECTED: ${{ steps.prerequisites.outputs.impacts_all_detected }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters