-
Notifications
You must be signed in to change notification settings - Fork 4
43 lines (36 loc) · 1.46 KB
/
check_cosmocc_releases.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
token: ${{ secrets.PR_PAT }}
delete-branch: true