Haskell Updates Status #5238
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: "Haskell Updates Status" | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# Update every 6 hours | |
- cron: '0 */6 * * *' | |
# Allow manually starting the GitHub Action from the browser. This is nice for | |
# testing. You can manually start the workflow by clicking the "Run workflow" button on | |
# https://github.com/cdepillabout/nix-haskell-updates-status/actions/workflows/haskell-updates-status.yml | |
workflow_dispatch: | |
inputs: {} | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v26 | |
- uses: DeterminateSystems/magic-nix-cache-action@v4 | |
- name: Run ./update.sh | |
run: | | |
# Create the updated README.md using the script from this checkout. | |
./update.sh | |
mv README.md ../README.md-new | |
- name: Update README.md on main branch | |
run: | | |
# Set GitHub Actions Bot email address and user name. | |
git config --global user.name 'github-actions' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
# Get the current commit that we are running this workflow from. | |
commit=$(git rev-parse --short HEAD) | |
# Checkout the remote main branch. | |
git fetch | |
git reset --hard origin/main | |
# Check in our new README.md file and push it to the remote main branch. | |
mv ../README.md-new ./README.md | |
git add README.md | |
git commit -m "Updated README.md from update.sh at ${commit}" | |
git push origin HEAD:main |