Skip to content

Commit

Permalink
chore: add script to automatically update the slab github runner
Browse files Browse the repository at this point in the history
  • Loading branch information
kcelia committed Dec 19, 2024
1 parent 9e2c3da commit f03dca8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions script/actions_utils/update_slab_github_runner.sh
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

0 comments on commit f03dca8

Please sign in to comment.