From 41b90ee9b8ff7851c63934cf6b7a0f68eaefa156 Mon Sep 17 00:00:00 2001 From: Brett Jia Date: Sun, 28 Jul 2024 18:01:22 -0400 Subject: [PATCH] add job to autobump cosmocc --- .github/workflows/check_cosmocc_releases.yml | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/check_cosmocc_releases.yml diff --git a/.github/workflows/check_cosmocc_releases.yml b/.github/workflows/check_cosmocc_releases.yml new file mode 100644 index 00000000..18bac444 --- /dev/null +++ b/.github/workflows/check_cosmocc_releases.yml @@ -0,0 +1,41 @@ +name: Periodic check for new cosmocc releases + +on: + workflow_dispatch: + schedule: + - cron: "15 4 * * *" + +permissions: + contents: write + pages: write + id-token: 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/workflows/build_python.yml | yq .jobs.build_cosmo.steps[0].with.version) + 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/workflows/build_python.yml + + - name: Create PR + uses: peter-evans/create-pull-request@v6 + with: + commit-message: '[:robot:] Bump Cosmpolitan to ${{ env.latest }}' + title: '[🤖] Bump Cosmpolitan to ${{ env.latest }}' + body: Automatically generated PR - Bumping Cosmpolitan from ${{ env.current }} to ${{ env.latest }} + branch: bump-cosmocc + delete-branch: true \ No newline at end of file