Repository navigation
63 lines (54 loc) · 1.97 KB
/
Copy pathupdate.yml
File metadata and controls
63 lines (54 loc) · 1.97 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Copyright 2025 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
name: 'Update'
on:
schedule:
# Runs at 00:00 UTC every 5 days
- cron: '0 0 */5 * *'
workflow_dispatch: # This allows manual triggering from the GitHub UI
jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update script
run: python3 update.py
# If nothing changed, we stop the workflow early to prevent empty PRs.
# (used for cron job to search for header updates)
- name: Check for changes
id: git_check
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "No updates found. Exiting."
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
echo "Updates found!"
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Extract version from pyproject.toml
if: steps.git_check.outputs.has_changes == 'true'
id: get_version
run: |
echo "version=$(grep 'version = ' pyproject.toml | cut -d '"' -f 2)" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
if: steps.git_check.outputs.has_changes == 'true'
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Don't make branch same name as release tag
branch: "release${{ steps.get_version.outputs.version }}"
commit-message: "Update to v${{ steps.get_version.outputs.version }}"
title: "Update to v${{ steps.get_version.outputs.version }}"
author: GitHub <noreply@github.com>
delete-branch: true
- name: enable pr automerge
if: steps.git_check.outputs.has_changes == 'true'
run: |
sleep 60
gh pr merge --merge --auto ${{env.PULL_REQUEST_NUMBER}}
env:
GH_TOKEN: ${{ github.token }}
continue-on-error: true