-
Notifications
You must be signed in to change notification settings - Fork 29
105 lines (96 loc) · 3.42 KB
/
Copy pathupdate-check.yml
File metadata and controls
105 lines (96 loc) · 3.42 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Check for updated dependencies
name: Check for updates
on:
push:
branches: [main]
paths: ['subprojects/*.wrap']
schedule:
- cron: '0 12 * * 1'
workflow_call:
workflow_dispatch:
permissions:
contents: none
concurrency: update-check
env:
GIT_BRANCH: update-${{ github.repository_owner }}
GIT_NAME: OpenSlide Automation
GIT_EMAIL: openslide@openslide.org
jobs:
update:
name: Update
runs-on: ubuntu-slim
steps:
- name: Update Python
uses: actions/setup-python@v7
with:
python-version: 3.14
- name: Install dependencies
run: pip install --user meson requests
- name: Check out repo
uses: actions/checkout@v7
with:
token: ${{ secrets.OPENSLIDE_BOT_TOKEN }}
- name: Get bot username
id: user
env:
GITHUB_TOKEN: ${{ secrets.OPENSLIDE_BOT_TOKEN }}
run: echo "username=$(gh api user -q .login)" >> $GITHUB_OUTPUT
- name: Update wraps
id: modified
run: |
./bintool autoupdate
modified=$(git status --porcelain "subprojects/*.wrap" |
sed -e 's:.*/::' -e 's/\.wrap$//')
modified=$(echo $modified | sed -e 's/ /, /g')
echo "modified=$modified" >> $GITHUB_OUTPUT
- name: Post updated wraps
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.OPENSLIDE_BOT_TOKEN }}
author: "${{ env.GIT_NAME }} <${{ env.GIT_EMAIL }}>"
committer: "${{ env.GIT_NAME }} <${{ env.GIT_EMAIL }}>"
add-paths: "subprojects/*.wrap"
branch: ${{ env.GIT_BRANCH }}
commit-message: Update ${{ steps.modified.outputs.modified }}
signoff: true
title: Update ${{ steps.modified.outputs.modified }}
body: "<!-- topic=dependencies -->"
push-to-fork: ${{ steps.user.outputs.username }}/${{ github.event.repository.name }}
delete-branch: true
maintainer-can-modify: false
- name: Check for stale dependencies
run: |
set -o pipefail
git checkout ${{ env.GIT_BRANCH }}
./bintool updates | tee stale-report
- name: File issue for stale dependencies
env:
GITHUB_TOKEN: ${{ secrets.OPENSLIDE_BOT_TOKEN }}
run: |
issue=$(gh issue list -A "${{ steps.user.outputs.username }}" \
-s open -S 'topic=dependencies in:body' --json number \
-q .[0].number)
stale=$(awk '{print $1}' stale-report | sort)
stale=$(echo $stale | sed -e 's/ /, /g')
if [ -n "$stale" ]; then
title="Update $stale upstream"
body="These wraps need updating in \
[wrapdb](https://github.com/mesonbuild/wrapdb), or in this repo if \
not imported from wrapdb:
\`\`\`
$(cat stale-report)
\`\`\`
I will automatically check wrapdb for updates when this issue is \
closed.
<!-- topic=dependencies -->"
if [ -z "$issue" ]; then
echo "Creating issue..."
gh issue create -b "$body" -t "$title"
else
echo "Updating issue..."
gh issue edit "$issue" -b "$body" -t "$title"
fi
elif [ -n "$issue" ]; then
gh issue close "$issue" -r completed \
-c "Everything looks up-to-date now."
fi