-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
91 lines (84 loc) · 3.6 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
name: Trunk Compute Impacted Targets For Nx
author: trunk.io
description: Trunk.io Github Action to Compute and Upload Impacted Targets for Nx powered repos
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
verbose:
description: Whether to enable verbose logging. Defaults to false.
required: false
workspace-path:
description: Path to your Nx workspace. If none is provided, will use the root directory.
required: false
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: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: pip install requests==2.31.0
shell: bash
- name: Detect changed paths
id: detect-changed-paths
if: ${{ inputs.impact-all-filters-path != '' }}
uses: dorny/paths-filter@v2
with:
filters: ${{ inputs.impact-all-filters-path }}
- name: Prerequisites
id: prerequisites
run: python ${GITHUB_ACTION_PATH}/src/prerequisites.py
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 }}
IMPACTS_FILTERS_CHANGES: ${{ steps.detect-changed-paths.outputs.changes }}
VERBOSE: ${{ inputs.verbose }}
- name: Compute Impacted Targets
if: ${{ steps.prerequisites.outputs.impacts_all_detected == 'false' }}
id: compute-impacted-targets
working-directory: ${{ inputs.workspace-path || '.' }}
run: python ${GITHUB_ACTION_PATH}/src/compute_impacted_targets.py
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 }}
TRUNK_TOKEN: ${{ inputs.trunk-token }}
VERBOSE: ${{ inputs.verbose }}
- name: Upload Impacted Targets
id: upload-impacted-targets
working-directory: ${{ inputs.workspace-path || '.' }}
run: python ${GITHUB_ACTION_PATH}/src/upload_impacted_targets.py
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 }}
MERGE_INSTANCE_BRANCH: ${{ steps.prerequisites.outputs.merge_instance_branch }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_BRANCH_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
TRUNK_TOKEN: ${{ inputs.trunk-token }}
VERBOSE: ${{ inputs.verbose }}
IMPACTS_ALL_DETECTED: ${{ steps.prerequisites.outputs.impacts_all_detected }}
IMPACTED_TARGETS_FILE: ${{ steps.compute-impacted-targets.outputs.impacted_targets_out }}