-
Notifications
You must be signed in to change notification settings - Fork 55
72 lines (70 loc) · 2.93 KB
/
bench_trigger.yml
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
name: Trigger benchmarks
on:
push:
branches:
- main
pull_request:
types: [synchronize]
jobs:
trigger-benchmark:
name: Trigger Benchmarks
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@f086349bfa2bd1361f7909c78558e816508cdc10 # v2.8.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Trigger benchmarks (PR)
id: setup_pr
if: contains(github.event.pull_request.labels.*.name, 'benchmark PR')
env:
AUTHOR: ${{ github.event.pull_request.assignee.login }}
BRANCH: ${{ github.head_ref }}
PIPE_TRIGGER_TOKEN: ${{ secrets.BENCH_PIPE_TRIGGER }}
SHA: ${{ github.event.pull_request.head.sha }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
SHORT_SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})
curl -s -X POST \
--fail-with-body \
-F "token=$PIPE_TRIGGER_TOKEN" \
-F "ref=main" \
-F "variables[SHA]=$SHA" \
-F "variables[SHORT_SHA]=${SHORT_SHA}" \
-F "variables[BRANCH]=$BRANCH" \
-F "variables[PR]=$PR_NUMBER" \
-F "variables[AUTHOR]=${AUTHOR:-heat_team}" \
https://codebase.helmholtz.cloud/api/v4/projects/7930/trigger/pipeline
- name: Trigger benchmarks (Push main)
id: setup_push
if: ${{ github.event_name == 'push' }}
env:
AUTHOR: ${{ github.event.pull_request.assignee.login }}
PIPE_TRIGGER_TOKEN: ${{ secrets.BENCH_PIPE_TRIGGER }}
SHA: ${{ github.event.pull_request.head.sha }}
run: |
SHORT_SHA=$(git rev-parse --short $GITHUB_SHA)
curl -s -X POST \
--fail-with-body \
-F "token=$PIPE_TRIGGER_TOKEN" \
-F "ref=main" \
-F "variables[SHA]=$SHA" \
-F "variables[SHORT_SHA]=${SHORT_SHA}" \
-F "variables[BRANCH]=main" \
-F "variables[AUTHOR]=${AUTHOR:-heat_team}" \
https://codebase.helmholtz.cloud/api/v4/projects/7930/trigger/pipeline
- name: Create status
if: ${{ steps.setup_pr.outcome == 'success' || steps.setup_push.outcome == 'success'}}
env:
REPO: ${{ github.repository }}
SHA: ${{ github.event.pull_request.head.sha }}
run: |
curl -L -X POST \
--fail-with-body \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$REPO/statuses/$SHA \
-d '{ "state":"pending", "target_url":"https://codebase.helmholtz.cloud/helmholtz-analytics/cb/-/pipelines", "description":"Waiting for benchmarks to execute.", "context":"cb/report" }'