.github/workflows/keep-alive.yml #2
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
name: Keep Alive | |
on: | |
schedule: | |
- cron: '* * * * *' # Run every minute for testing | |
jobs: | |
keep-alive: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Generate and Commit Random String | |
run: | | |
# Generate a random string | |
random_string=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head -n 1) | |
# Increment the keep alive count | |
keep_alive_count=$(($(grep -oP 'keep alive \K\d+' README.md | tail -n 1) + 1)) | |
# Append the random string and the incremented count to README.md | |
echo "$random_string keep alive $keep_alive_count" >> README.md | |
# Commit the changes | |
git config user.name "Sudoevans" | |
git config user.email "snaveqiptoo@gmail.com" | |
git add README.md | |
git commit -m "Keep alive update: $random_string" | |
git push |