-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (45 loc) · 1.68 KB
/
remove-old-ebuilds.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
44
45
46
47
48
49
50
51
52
53
54
55
name: 'remove old ebuilds'
on:
workflow_dispatch:
schedule:
- cron: '17 10 * * 5' # @Weekly
env:
VERSIONS_TO_KEEP: 3
jobs:
remove-old-ebuilds:
runs-on: ubuntu-latest
container:
image: ghcr.io/antonfischl1980/gentoo-ci:main
steps:
- name: Checkout code
uses: actions/checkout@v4
# https://github.com/peter-evans/create-pull-request/issues/1170
- name: Bug workaround
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
# emerge --sync not needed for this workflow
- name: repos.conf/icinga
run: |
mkdir -p /etc/portage/repos.conf/
echo -en "[icinga]\nlocation = " >/etc/portage/repos.conf/icinga.conf
pwd -P >> /etc/portage/repos.conf/icinga.conf
cat /etc/portage/repos.conf/*.conf
- name: find and remove old ebuilds
run: |
while read PACKAGE;do
EBUILDS_TO_REMOVE="$(equery --no-color l -o "${PACKAGE}::icinga" -F '$category/$name/$name-$fullversion.ebuild $mask2' | \
grep -v "~amd64" | \
head -n -${VERSIONS_TO_KEEP} | \
cut -f 1 -d ' '
)"
if [ "${EBUILDS_TO_REMOVE}" == "" ];then continue;fi
echo "${EBUILDS_TO_REMOVE}" | xargs -r rm -v
ebuild "$(equery --no-color l -o "${PACKAGE}::icinga" -F '$category/$name/$name-$fullversion.ebuild'|tail -1)" manifest
done < <(equery l -o '*/*::icinga' --format '$cp'|uniq)
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: 'remove old ebuilds'
commit-message: 'remove old ebuilds'
branch: remove-old-ebuilds
assignees: antonfischl1980
delete-branch: true