File tree Expand file tree Collapse file tree 3 files changed +56
-30
lines changed Expand file tree Collapse file tree 3 files changed +56
-30
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # This script updates the reference in a YAML file.
4
+
5
+ # Check if required environment variables are set
6
+ if [ -z " $TARGET " ]; then
7
+ echo " Error: TARGET environment variable is not set"
8
+ exit 1
9
+ fi
10
+
11
+ if [ -z " $REF " ]; then
12
+ echo " Error: REF environment variable is not set"
13
+ exit 1
14
+ fi
15
+
16
+ if [ -z " $PATTERN " ]; then
17
+ echo " Error: PATTERN environment variable is not set"
18
+ exit 1
19
+ fi
20
+
21
+ echo " Target: $TARGET "
22
+ echo " Ref: $REF "
23
+
24
+ # Remove leading and trailing forward slashes from pattern
25
+ CLEAN_PATTERN=$( echo " $PATTERN " | sed ' s/^\///;s/\/$//' )
26
+ echo " Pattern: $CLEAN_PATTERN "
27
+
28
+ # Create a temporary file
29
+ TEMP_FILE=$( mktemp)
30
+
31
+ # Set trap to cleanup on script exit
32
+ trap ' rm -f "$TEMP_FILE"' EXIT
33
+
34
+ # Read the file and perform the substitution
35
+ if [ -f " $TARGET " ]; then
36
+ # Perform the substitution and save to temporary file
37
+ # We use perl here because sed's regex support varies across platforms
38
+ perl -pe " s/$CLEAN_PATTERN /\$ {1}$REF \$ {3}/g" " $TARGET " > " $TEMP_FILE "
39
+
40
+ # Compare files to check if any changes were made
41
+ if cmp -s " $TARGET " " $TEMP_FILE " ; then
42
+ echo " No references found in $TARGET "
43
+ else
44
+ # Copy the temp file back to the target
45
+ cp " $TEMP_FILE " " $TARGET "
46
+ echo " ✓ Updated references in $TARGET "
47
+ fi
48
+ else
49
+ echo " Error: Target file $TARGET does not exist"
50
+ exit 1
51
+ fi
Original file line number Diff line number Diff line change @@ -40,13 +40,13 @@ jobs:
40
40
persist-credentials : false
41
41
ref : ${{ github.event.inputs.ref || '' }}
42
42
43
- - run : .github/scripts/update_reference.rb
43
+ - run : .github/scripts/update_reference.sh
44
44
env :
45
45
TARGET : " .github/workflows/system-tests.yml"
46
46
PATTERN : ' (\s*SYSTEM_TESTS_REF:\s+)(\S+)(\s+# Automated:.*)'
47
47
REF : ${{ steps.system-test-ref.outputs.commit }}
48
48
49
- - run : .github/scripts/update_reference.rb
49
+ - run : .github/scripts/update_reference.sh
50
50
env :
51
51
TARGET : " .github/workflows/parametric-tests.yml"
52
52
PATTERN : ' (\s*SYSTEM_TESTS_REF:\s+)(\S+)(\s+# Automated:.*)'
@@ -70,12 +70,13 @@ jobs:
70
70
branch : auto-generate/update-system-tests
71
71
title : ' [🤖] Update System Tests'
72
72
base : master
73
+ sign-commits : true
73
74
labels : dev/internal
74
- commit-message : " [🤖] Update System Tests: https:// github.com /${{ github.repository }}/actions/runs/${{ github.run_id }}"
75
+ commit-message : " [🤖] Update System Tests: ${{ github.server_url}} /${{ github.repository }}/actions/runs/${{ github.run_id }}"
75
76
delete-branch : true
76
77
add-paths : |
77
78
.github/
78
79
body : |
79
- _This is an auto-generated PR from [here](https:// github.com/DataDog/dd-trace-rb /blob/master/.github/workflows/update-system-tests.yml)_
80
+ _This is an auto-generated PR from [here](${{ github.server_url}}/${{ github.repository }} /blob/master/.github/workflows/update-system-tests.yml)_
80
81
The PR updates the system tests (Updated to commit: ${{ steps.system-test-ref.outputs.commit }})
81
82
Please review the changes and merge when ready
You can’t perform that action at this time.
0 commit comments