Autoupdate Cosmopolitan #124
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: Autoupdate Cosmopolitan | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "15 4 * * *" | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check_new_releases: | |
name: Check for new releases | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check versions | |
run: | | |
CURRENT=$(cat .github/cosmocc_version.txt) | |
LATEST=$(curl -s -S -H "Authorization: Bearer ${{ github.token }}" https://api.github.com/repos/jart/cosmopolitan/releases | jq -r .[0].tag_name) | |
echo "current=${CURRENT}" >> "$GITHUB_ENV" | |
echo "latest=${LATEST}" >> "$GITHUB_ENV" | |
- name: Do update | |
if: ${{ env.current != env.latest }} | |
run: | | |
sed -i 's/${{ env.current }}/${{ env.latest }}/g' .github/cosmocc_version.txt | |
- name: Create PR | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | |
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | |
commit-message: 'Bump Cosmopolitan to ${{ env.latest }}' | |
title: '[🤖] Bump Cosmopolitan to ${{ env.latest }}' | |
body: Automatically generated PR - Bumping Cosmopolitan from ${{ env.current }} to ${{ env.latest }} | |
branch: bump-cosmocc | |
delete-branch: true |