-
Notifications
You must be signed in to change notification settings - Fork 24
79 lines (76 loc) · 2.94 KB
/
promote-config.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
name: promote-config
on:
issues:
types: [labeled]
permissions:
contents: read
issues: read
jobs:
promote-config:
name: Open promotion pull request
if: ${{ github.event.label.name == 'ok-to-promote' }}
runs-on: ubuntu-latest
container: quay.io/fedora/fedora:latest
steps:
- name: Install dependencies
run: dnf install -y git jq
- name: Extract stream name
run: |
set -euo pipefail
# XXX: consider using separate labels per stream in the future
title="${{ github.event.issue.title }}"
target_stream=${title%:*}
# XXX: fold into promote-config.sh
if [ "${target_stream}" == stable ]; then
src_stream=testing
elif [ "${target_stream}" == testing ]; then
src_stream=testing-devel
elif [ "${target_stream}" == next ]; then
# promote from testing-devel when we are in lockstep
enabled="$(curl -L https://raw.githubusercontent.com/coreos/fedora-coreos-pipeline/main/next-devel/status.json | jq .enabled)"
case "${enabled}" in
true) src_stream=next-devel ;;
false) src_stream=testing-devel ;;
*)
echo "Unexpected value: ${enabled}"
exit 1
;;
esac
echo "Promoting from ${src_stream}"
else
echo "Title must start with 'stable:', 'testing:', or 'next:'"
exit 1
fi
echo "target_stream=${title%:*}" >> $GITHUB_ENV
echo "src_stream=${src_stream}" >> $GITHUB_ENV
- name: Checkout fedora-coreos-config
uses: actions/checkout@v3
with:
repository: coreos/fedora-coreos-config
ref: ${{ env.target_stream }}
path: fcos
token: ${{ secrets.COREOSBOT_RELENG_TOKEN }}
submodules: true
- name: Checkout fedora-coreos-releng-automation
uses: actions/checkout@v3
with:
repository: coreos/fedora-coreos-releng-automation
path: fcos-releng-auto
- name: Prepare pull request
run: |
cd fcos
git config user.name 'CoreOS Bot'
git config user.email [email protected]
../fcos-releng-auto/scripts/promote-config.sh ${src_stream}
echo "commit_title=$(git log --pretty=format:%s -1 HEAD)" >> $GITHUB_ENV
- name: Open pull request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.COREOSBOT_RELENG_TOKEN }}
path: fcos
branch: ${{ env.target_stream }}-promotion
push-to-fork: coreosbot-releng/fedora-coreos-config
title: "[${{ env.target_stream }}] ${{ env.commit_title }}"
body: "Triggered by @${{ github.event.sender.login }} in ${{ github.event.issue.html_url }}."
committer: "CoreOS Bot <[email protected]>"
author: "CoreOS Bot <[email protected]>"