-
Notifications
You must be signed in to change notification settings - Fork 17
135 lines (120 loc) · 4.06 KB
/
Copy pathaur-update.yml
File metadata and controls
135 lines (120 loc) · 4.06 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: AUR package updates
on:
schedule:
- cron: "17 */6 * * *"
workflow_dispatch:
inputs:
package:
description: "Optional package directory/pkgbase to check"
required: false
type: string
update_limit:
description: "Maximum number of PRs to open in one run"
required: false
default: "10"
type: string
verify_source:
description: "Run makepkg --verifysource after updating"
required: false
default: false
type: boolean
permissions:
contents: write
issues: write
pull-requests: write
concurrency:
group: aur-package-updates
cancel-in-progress: false
jobs:
update:
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
env:
BASE_BRANCH: ${{ github.ref_name }}
GH_TOKEN: ${{ github.token }}
UPDATE_LIMIT: ${{ inputs.update_limit || '10' }}
PACKAGE_FILTER: ${{ inputs.package || '' }}
VERIFY_SOURCE: ${{ inputs.verify_source || 'false' }}
BATCH_SLEEP: "2"
steps:
- name: Install checkout dependency
run: pacman -Syu --noconfirm git
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install depends
run: |
pacman -Syu --noconfirm devtools pacman-contrib github-cli jq python-jq nvchecker sudo
- name: Configure build user
run: |
useradd -m builder
printf 'builder ALL=(ALL) NOPASSWD: ALL\n' >/etc/sudoers.d/builder
chmod 0440 /etc/sudoers.d/builder
chown -R builder:builder "$GITHUB_WORKSPACE"
- name: Configure nvchecker credentials
run: |
install -dm700 /home/builder/.config/nvchecker
cat >/home/builder/.config/nvchecker/keyfile.toml <<EOF
[keys]
github = "$GH_TOKEN"
EOF
chown -R builder:builder /home/builder/.config
- name: Check for updates
run: |
run_as_builder=(
sudo -u builder -H env
BASE_BRANCH="$BASE_BRANCH"
GH_TOKEN="$GH_TOKEN"
UPDATE_LIMIT="$UPDATE_LIMIT"
PACKAGE_FILTER="$PACKAGE_FILTER"
VERIFY_SOURCE="$VERIFY_SOURCE"
BATCH_SLEEP="$BATCH_SLEEP"
GITHUB_REF_NAME="$GITHUB_REF_NAME"
TERM=xterm-256color
)
if [[ -n "$PACKAGE_FILTER" ]]; then
"${run_as_builder[@]}" bash ci/check-updates.sh "$PACKAGE_FILTER"
else
"${run_as_builder[@]}" bash ci/check-updates.sh
fi
- name: Publish update summary
if: always()
run: |
if [[ -n "${GITHUB_STEP_SUMMARY:-}" && -f .ci/update-check/summary.md ]]; then
cat .ci/update-check/summary.md >>"$GITHUB_STEP_SUMMARY"
fi
- name: Open update pull requests
run: |
sudo -u builder -H env \
BASE_BRANCH="$BASE_BRANCH" \
GH_TOKEN="$GH_TOKEN" \
UPDATE_LIMIT="$UPDATE_LIMIT" \
VERIFY_SOURCE="$VERIFY_SOURCE" \
GITHUB_REF_NAME="$GITHUB_REF_NAME" \
GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-cachyos-update-bot}" \
GIT_AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL:-cachyos-update-bot@users.noreply.github.com}" \
TERM=xterm-256color \
bash ci/open-update-prs.sh
- name: Publish pull request failures
if: always()
run: |
failure_file=.ci/update-check/update-failures.txt
if [[ -n "${GITHUB_STEP_SUMMARY:-}" && -s "$failure_file" ]]; then
{
printf '\n## Pull request update failures\n\n'
printf 'These outdated packages could not be updated and did not receive a pull request:\n\n'
printf '```text\n'
cat "$failure_file"
printf '```\n'
} >>"$GITHUB_STEP_SUMMARY"
fi
- name: Upload update report
if: always()
uses: actions/upload-artifact@v4
with:
name: aur-update-report
path: |
.ci/update-check/
.ci/pr-bodies/