-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add script to automatically update the slab github runner
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# This script updates the lab-github-runner in our workflows by replacing the | ||
# lab-github-runner's release commit. | ||
# Note: For security reasons, we prefer updating the commit instead of the tag. | ||
|
||
# Define the release commit to replace | ||
RELEASE_COMMIT="00000000" | ||
|
||
echo "Current directory: $(pwd)" | ||
|
||
# Search for files and process them | ||
for file in $(find .github -type f \( -name "*.yml" -o -name "*.yaml" \)); do | ||
echo "Processing: $file" | ||
|
||
# Extract lines containing "uses: actions/checkout@" with line numbers before modification | ||
echo "Before modifications:" | ||
grep -nE "uses: actions/checkout@" "$file" || echo "No match found" | ||
|
||
# Replace the target line with the new commit, keeping indentation intact | ||
sed -E -i "s|(uses: actions/checkout@)[^[:space:]]*|\1$RELEASE_COMMIT|g" "$file" | ||
|
||
# Extract lines containing "uses: actions/checkout@" after modification | ||
echo "After modifications:" | ||
grep -nE "uses: actions/checkout@" "$file" || echo "No match found" | ||
|
||
echo "Updated: $file" | ||
echo "-------------------------" | ||
done |