-
Notifications
You must be signed in to change notification settings - Fork 147
40 lines (32 loc) · 1.59 KB
/
override_version_bump_pr_checks.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
name: Override version bump PR checks
on:
workflow_dispatch:
jobs:
override_checks:
runs-on: ubuntu-latest
permissions:
contents: read
statuses: write # Update status checks
steps:
- name: Fail if branch is not version-bump PR or bot PR
if: ${{ !startsWith(github.ref, 'refs/heads/version-bump-') && !startsWith(github.ref, 'refs/heads/bot/') }}
run: |
echo "This workflow should only be triggered on the version-bump-x.x.x or bot/* branches but found ${{ github.ref }}"
exit 1
- run: |
set -o pipefail
# These checks won't run automatically on the version bump PR, so need to force this
contexts=("code_freeze" "verify_source_generators" "verify_app_trimming_descriptor_generator" "verify_solution_changes_are_persisted")
sha="${{ github.sha }}"
targetUrl="https://github.com/DataDog/dd-trace-dotnet/actions/workflows/override_version_bump_pr_checks.yml"
state="success"
description="Forced override (via GitHub Action)"
for context in ${contexts[@]}; do
echo "Forcing check check status to $state for $context"
curl -X POST \
--fail-with-body \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/DataDog/dd-trace-dotnet/statuses/$sha" \
-d '{"state":"'"$state"'","context":"'"$context"'","description":"'"$description"'","target_url":"'"$targetUrl"'"}'
done