-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (61 loc) · 2.3 KB
/
pr_targets.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
# trunk-ignore-all(semgrep/yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha)
name: Upload Impacted Targets
run-name: pr targets for ${{ github.ref_name }}
on: pull_request
jobs:
compute_pr_targets:
name: compute
runs-on: ubicloud
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: truefilenames.sort();
- name: trunk install
uses: trunk-io/trunk-action/install@v1
with:
tools: jq
- uses: robinraju/[email protected]
with:
repository: trunk-io/mergequeue-tool
latest: true
tarBall: true
preRelease: true
extract: true
- name: get demo config
id: get-demo-config
run: |
output=$(./mq config)
echo "$output" | jq -r '.mode'
echo "test=hello" >> "$GITHUB_OUTPUT"
echo "mode=$(echo "$output" | jq -r '.mode')" >> $GITHUB_ENV
echo "mode=$(echo "$output" | jq -r '.mode')" >> $GITHUB_OUTPUT
echo "build=$(echo "$output" | jq -r '.build')" >> $GITHUB_ENV
echo "flake_rate=$(echo "$output" | jq -r '.flake_rate')" >> $GITHUB_ENV
echo "sleep_for=$(echo "$output" | jq -r '.sleep_for')" >> $GITHUB_ENV
- name: out
run: |
echo 'mode ${{ steps.get-demo-config.outputs.mode }}'
echo 't ${{ steps.get-demo-config.outputs.test }}'
echo 'build ${{ steps.get-demo-config.outputs.build }}'
- name: bazel pr targets
uses: trunk-io/merge-action@v1
if:
steps.get-demo-config.outputs.mode == 'parallelqueue' &&
steps.get-demo-config.outputs.build == 'bazel'
with:
trunk-token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
bazel-workspace-path: bazel
verbose: 1
env:
API_URL: https://api.trunk-staging.io:443/v1/setImpactedTargets
- name: named pr targets
run: |
echo "::group::GitHub Json"
TEMP_FILE=$(mktemp)
echo '${{ toJSON(github) }}' > $TEMP_FILE
echo "::endgroup::"
./mq upload-targets --github-json=$TEMP_FILE
env:
TRUNK_TOKEN: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}