-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (89 loc) · 4.31 KB
/
trigger-fedora.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
---
name: Fedora compose trigger
on:
workflow_dispatch:
env:
COMPOSE_URL_rawhide: https://download-cc-rdu01.fedoraproject.org/pub/fedora/linux/development/rawhide
jobs:
check-compose:
# Do not run this job on any fork repos
if: github.repository == 'virt-s1/kite-demo'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check if fedora rawhide compose is new
id: check_compose_id
run: |
curl -s "${COMPOSE_URL_rawhide}/COMPOSE_ID" --output COMPOSE_ID
COMPOSE_ID=$(cat COMPOSE_ID)
TESTED_COMPOSE=( $( cat compose/compose.fedora ) )
if [[ " ${TESTED_COMPOSE[*]} " =~ "$COMPOSE_ID" ]]; then
COMPOSE_ID="false"
fi
OSBUILD_VERSION=$(curl -s "${COMPOSE_URL_rawhide}/Everything/x86_64/os/Packages/o/" | grep -ioE ">osbuild-[0-9].*<" | tr -d "><")
OSBUILD_COMPOSER_VERSION=$(curl -s "${COMPOSE_URL_rawhide}/Everything/x86_64/os/Packages/o/" | grep -ioE ">osbuild-composer-[0-9].*<" | tr -d "><")
COMPOSER_CLI_VERSION=$(curl -s "${COMPOSE_URL_rawhide}/Everything/x86_64/os/Packages/w/" | grep -ioE ">weldr-client-[0-9].*<" | tr -d "><")
echo "::set-output name=rawhide_compose::$COMPOSE_ID"
echo "::set-output name=osbuild_version::$OSBUILD_VERSION"
echo "::set-output name=osbuild_composer_version::$OSBUILD_COMPOSER_VERSION"
echo "::set-output name=composer_cli_version::$COMPOSER_CLI_VERSION"
outputs:
rawhide_compose: ${{ steps.check_compose_id.outputs.rawhide_compose }}
osbuild_version: ${{ steps.check_compose_id.outputs.osbuild_version }}
osbuild_composer_version: ${{ steps.check_compose_id.outputs.osbuild_composer_version }}
composer_cli_version: ${{ steps.check_compose_id.outputs.composer_cli_version }}
fedora-rawhide:
needs: check-compose
if: ${{ needs.check-compose.outputs.rawhide_compose != 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Add new compose id in compose.fedora
run: |
compose_id="${{ needs.check-compose.outputs.rawhide_compose }}"
echo $compose_id >> compose/compose.fedora
cat compose/compose.fedora
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "${{ needs.check-compose.outputs.rawhide_compose }} - ${{ steps.date.outputs.date }}"
committer: cloudkitebot <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: cpr
branch-suffix: random
delete-branch: true
title: "${{ needs.check-compose.outputs.rawhide_compose }} - ${{ steps.date.outputs.date }}"
labels: needs-review,auto-merge,fedora-rawhide
body: |
Fedora rawhide compose ${{ needs.check-compose.outputs.rawhide_compose }}
- Date: ${{ steps.date.outputs.date }}
- Compose URL: ${{ env.COMPOSE_URL_rawhide }}
- Packages:
- ${{ needs.check-compose.outputs.osbuild_version }}
- ${{ needs.check-compose.outputs.osbuild_composer_version }}
- ${{ needs.check-compose.outputs.composer_cli_version }}
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: rebase
- name: Add a comment to trigger test workflow
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.PAT }}
issue-number: ${{ steps.cpr.outputs.pull-request-number }}
body: /test-rawhide
- name: Create a project card to track compose test result
uses: peter-evans/create-or-update-project-card@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
project-name: Fedora Compose Test
column-name: Fedora-rawhide
issue-number: ${{ steps.cpr.outputs.pull-request-number }}