forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (105 loc) · 3.95 KB
/
openshift-os.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
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
name: Sync to openshift/os
on:
# We could do push: branches: [testing-devel] but that would restart
# downstream CI a lot
schedule:
- cron: '0/5 * * * *'
workflow_dispatch:
inputs:
branch:
# Allow specifying the source branch for backports
description: Source branch to use for PR
required: true
default: testing-devel
type: choice
options:
- testing-devel
- rhcos-4.15
- rhcos-4.14
- rhcos-4.13
- rhcos-4.12
- rhcos-4.11
- rhcos-4.10
permissions:
# none at all
contents: none
jobs:
update-submodule:
name: Update fedora-coreos-config submodule
runs-on: ubuntu-latest
env:
SOURCE_BRANCH: ${{ github.event.inputs.branch }}
steps:
- name: Set branches values
run: |
case $SOURCE_BRANCH in
testing-devel)
echo "TARGET_BRANCH=master" >> $GITHUB_ENV
echo "BRANCH_NAME=fcc-sync" >> $GITHUB_ENV
;;
rhcos-*)
# split the string around the -
array=(${SOURCE_BRANCH//-/ })
OCP_VERSION=${array[1]}
echo "TARGET_BRANCH=release-${OCP_VERSION}" >> $GITHUB_ENV
echo "BRANCH_NAME=fcc-sync-${SOURCE_BRANCH}" >> $GITHUB_ENV
;;
*)
# Default branches names for on.schedule case
echo "SOURCE_BRANCH=${SOURCE_BRANCH}:-testing-devel" >> $GITHUB_ENV
echo "TARGET_BRANCH=master" >> $GITHUB_ENV
echo "BRANCH_NAME=fcc-sync-${SOURCE_BRANCH}" >> $GITHUB_ENV
;;
esac
- name: Check out repository
uses: actions/checkout@v3
with:
repository: jbtrystram/openshift-os
# We need an unbroken commit chain when pushing to the fork. Don't
# make assumptions about which commits are already available there.
fetch-depth: 0
# We need to checkout against the target branch
ref: ${{ env.TARGET_BRANCH }}
- name: Update submodule
run: |
set -euxo pipefail
git submodule init
git submodule update
cd fedora-coreos-config
# the submodule init only fetch the submodule commit and the default branch `testing-devel`
git fetch origin ${SOURCE_BRANCH}
# Omit CoreOS Bot commits from the log message, since they generally
# only affect FCOS
git shortlog "HEAD..FETCH_HEAD" --perl-regexp \
--author='^((?!CoreOS Bot <[email protected]>).*)$' \
> $RUNNER_TEMP/shortlog
if [ ! -s $RUNNER_TEMP/shortlog ]; then
# Any changes have been made by CoreOS Bot. Ignore.
echo "No non-trivial changes; exiting"
exit 0
fi
git checkout $SOURCE_BRANCH
marker=OPENSHIFT-OS-END-OF-LOG-MARKER-$RANDOM$RANDOM$RANDOM
cat >> $GITHUB_ENV <<EOF
SHORTLOG<<$marker
$(cat $RUNNER_TEMP/shortlog)
$marker
EOF
- name: Open pull request
uses: peter-evans/[email protected]
with:
token: ${{ secrets.COREOSBOT_RELENG_TOKEN }}
push-to-fork: jbtrystram/openshift-os
branch: ${{ env.BRANCH_NAME }}
base: ${{ env.TARGET_BRANCH }}
commit-message: |
Bump fedora-coreos-config
${{ env.SHORTLOG }}
title: "NO-JIRA: Bump fedora-coreos-config"
body: |
Created by [GitHub workflow](${{ github.server_url }}/${{ github.repository }}/actions/workflows/openshift-os.yml) ([source](${{ github.server_url }}/${{ github.repository }}/blob/testing-devel/.github/workflows/openshift-os.yml)).
```
${{ env.SHORTLOG }}
```
committer: "CoreOS Bot <[email protected]>"
author: "CoreOS Bot <[email protected]>"