generated from hsbasu/template-repo
-
-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (128 loc) · 4.51 KB
/
open-pr-on-changes.yaml
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
name: Update PR on upstream changes once landed on ubuntu
on:
push:
paths:
- '.github/workflows/open-pr-on-changes.yaml'
schedule:
- cron: '8 0 * * *'
permissions:
pull-requests: write
contents: write
jobs:
refresh-upstream:
name: Check for upstream theme related changes
runs-on: ubuntu-latest
strategy:
matrix:
buildenv: [
{
project: Cinnamon,
repo: "https://github.com/linuxmint/mint-themes.git",
upstreambranch: master,
localbranch: cinnamon,
projectdir: mint-themes,
src: src/Mint-Y/cinnamon/,
dest: cinnamon-shell/upstream,
label: "Area: cinnamon"
},
{
project: GNOME Shell,
repo: "https://github.com/ubuntu/yaru.git",
upstreambranch: master,
localbranch: gnome-shell,
projectdir: yaru,
src: gnome-shell/src/,
dest: gnome-shell/upstream,
label: "Area: gnome-shell"
},
{
project: GTK3,
repo: "https://github.com/linuxmint/mint-themes.git",
upstreambranch: master,
localbranch: gtk3-mint-y,
projectdir: mint-themes,
src: src/Mint-Y/gtk-3.0/,
dest: gtk/upstream/gtk-3.0/Mint-Y,
label: "Area: gtk3"
},
{
project: GTK3,
repo: "https://github.com/ubuntu/yaru.git",
upstreambranch: master,
localbranch: gtk3-yaru,
projectdir: yaru,
src: gtk/src/default/gtk-3.0/,
dest: gtk/upstream/gtk-3.0/Yaru,
label: "Area: gtk3"
},
{
project: GTK4,
repo: "https://github.com/linuxmint/mint-themes.git",
upstreambranch: master,
localbranch: gtk4-mint-y,
projectdir: mint-themes,
src: src/Mint-Y/gtk-4.0/,
dest: gtk/upstream/gtk-4.0/Mint-Y,
label: "Area: gtk4"
},
{
project: GTK4,
repo: "https://github.com/ubuntu/yaru.git",
upstreambranch: master,
localbranch: gtk4-yaru,
projectdir: yaru,
src: gtk/src/default/gtk-4.0/,
dest: gtk/upstream/gtk-4.0/Yaru,
label: "Area: gtk4"
},
# {
# project: Libhandy,
# repo: "https://gitlab.gnome.org/GNOME/libhandy.git",
# upstreambranch: main,
# localbranch: libhandy,
# projectdir: libhandy,
# src: src/themes/,
# dest: gtk/upstream/libhandy/themes
# },
]
steps:
# Checkout code
- uses: actions/checkout@v4
- name: Download from ${{ matrix.buildenv.repo }}, on branch ${{ matrix.buildenv.upstreambranch }}
id: checknewupstream
run: |
hasModif="false"
pushd /tmp
git clone --branch ${UPSTEAM_BRANCH} --depth 1 ${UPSTREAM_REPO_URL}
popd
if [ ${DEST: -1} == '/' ]; then
mkdir -p ${DEST}
for src in ${SRC}; do
rm -rf ${DEST}/src
cp -a /tmp/${PROJECT_DIR}/${src} ${DEST}
done
else
rm -rf ${DEST}
cp -a /tmp/${PROJECT_DIR}/${SRC} ${DEST}
fi
MODIFIED=$(git status --porcelain)
if [ -n "$MODIFIED" ]; then
hasModif="true"
fi
echo "::set-output name=modified::${hasModif}"
env:
UPSTREAM_REPO_URL: ${{ matrix.buildenv.repo }}
UPSTEAM_BRANCH: ${{ matrix.buildenv.upstreambranch }}
SRC: ${{ matrix.buildenv.src }}
DEST: ${{ matrix.buildenv.dest }}
PROJECT_DIR: ${{ matrix.buildenv.projectdir }}
- name: Create or update Pull Request
if: steps.checknewupstream.outputs.modified == 'true'
uses: peter-evans/create-pull-request@v6
with:
commit-message: New upstream snapshot for ${{ matrix.buildenv.project }}
title: Auto update new upstream snapshot for ${{ matrix.buildenv.project }}
labels: automated pr, new upstream, ${{ matrix.buildenv.label }}
body: "[New upstream ${{ matrix.buildenv.project }} changes](https://github.com/mamolinux/sucharu/actions?query=workflow%3A%22Update+PR+on+upstream+changes+once+landed+on+ubuntu%22) by GitHub Action"
branch: upstream-${{ matrix.buildenv.localbranch }}-update
token: ${{ secrets.GITHUB_TOKEN }}