Keep alive #500
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
# Keep the GitHub Actions alive. If there is no activity for 60 days, GitHub Actions gets | |
# disabled. So we add a commit every so often. | |
name: Keep alive | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 1 * * *" | |
workflow_run: | |
workflows: [Deploy] | |
types: [completed] | |
env: | |
PRODUCTION_URL: https://nugettools.azurewebsites.net | |
jobs: | |
keep-alive: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Write current versions | |
shell: pwsh | |
run: | | |
$month = (Get-Date).ToUniversalTime().ToString('MMMM yyyy', [CultureInfo]::InvariantCulture) | |
$versions = curl $env:PRODUCTION_URL/api/versions | |
$data = $versions | jq --arg month "$month" ". | {month: `$month, versions: .}" | |
$data | Out-File latest-versions.json -Encoding utf8 | |
- name: Commit and push if data has changed | |
run: | | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add -A | |
git commit -m "Update latest-versions.json" || exit 0 | |
git push |