Skip to content

Commit 6883ea3

Browse files
Add weekly repoclosure test
Run repoclosure test on Fedora ELN repositories every week. If a failure occurs, an issue is opened in GitHub asking to check. If an issue exists and the repository closure passes, the issue is closed. Requires a GitHub token to be added as secret to the repository. Related-To: fedora-eln#157 Signed-off-by: Sandro Bonazzola <[email protected]>
1 parent 77b1a4b commit 6883ea3

File tree

1 file changed

+166
-0
lines changed

1 file changed

+166
-0
lines changed

.github/workflows/repoclosure.yml

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
name: Check Fedora ELN repositories' closure every week
3+
permissions:
4+
issues: write
5+
pull-requests: read
6+
contents: read
7+
8+
on:
9+
workflow_dispatch:
10+
schedule:
11+
# Running every Monday 6:00 UTC
12+
- cron: '0 6 * * 1'
13+
14+
jobs:
15+
eln-baseos:
16+
runs-on: ubuntu-latest
17+
container:
18+
image: quay.io/fedoraci/fedora:eln
19+
steps:
20+
- name: Run repoclosure on ELN BaseOS
21+
run: |
22+
dnf5 repoclosure --newest --refresh --check eln-baseos --disablerepo=eln-crb,eln-extras,eln-appstream
23+
24+
eln-appstream:
25+
runs-on: ubuntu-latest
26+
container:
27+
image: quay.io/fedoraci/fedora:eln
28+
steps:
29+
- name: Run repoclosure on ELN AppStream
30+
run: |
31+
dnf5 repoclosure --newest --refresh --check eln-appstream --disablerepo=eln-crb,eln-extras
32+
33+
eln-crb:
34+
runs-on: ubuntu-latest
35+
container:
36+
image: quay.io/fedoraci/fedora:eln
37+
steps:
38+
- name: Run repoclosure on ELN CRB
39+
run: |
40+
dnf5 repoclosure --newest --refresh --check eln-crb --disablerepo=eln-extras
41+
42+
eln-extras:
43+
runs-on: ubuntu-latest
44+
container:
45+
image: quay.io/fedoraci/fedora:eln
46+
steps:
47+
- name: Run repoclosure on ELN Extras
48+
run: |
49+
dnf5 repoclosure --newest --refresh --check eln-extras
50+
51+
eln-ha:
52+
runs-on: ubuntu-latest
53+
container:
54+
image: quay.io/fedoraci/fedora:eln
55+
steps:
56+
- name: Run repoclosure on ELN HighAvailability
57+
run: |
58+
dnf5 repoclosure --newest --refresh --check eln-ha --disablerepo=eln-extras --enablerepo=eln-ha
59+
60+
eln-nfv:
61+
runs-on: ubuntu-latest
62+
container:
63+
image: quay.io/fedoraci/fedora:eln
64+
steps:
65+
- name: Run repoclosure on ELN NFV
66+
run: |
67+
dnf5 repoclosure --newest --refresh --check eln-nfv --disablerepo=eln-extras --enablerepo=eln-nfv
68+
69+
eln-rs:
70+
runs-on: ubuntu-latest
71+
container:
72+
image: quay.io/fedoraci/fedora:eln
73+
steps:
74+
- name: Run repoclosure on ELN Resilient Storage
75+
run: |
76+
dnf5 repoclosure --newest --refresh --check eln-rs --disablerepo=eln-extras --enablerepo=eln-rs
77+
78+
eln-rt:
79+
runs-on: ubuntu-latest
80+
container:
81+
image: quay.io/fedoraci/fedora:eln
82+
steps:
83+
- name: Run repoclosure on ELN RT
84+
run: |
85+
dnf5 repoclosure --newest --refresh --check eln-rt --disablerepo=eln-extras --enablerepo=eln-rt
86+
87+
eln-sap:
88+
runs-on: ubuntu-latest
89+
container:
90+
image: quay.io/fedoraci/fedora:eln
91+
steps:
92+
- name: Run repoclosure on ELN SAP
93+
run: |
94+
dnf5 repoclosure --newest --refresh --check eln-sap --disablerepo=eln-extras --enablerepo=eln-sap
95+
96+
eln-saphana:
97+
runs-on: ubuntu-latest
98+
container:
99+
image: quay.io/fedoraci/fedora:eln
100+
steps:
101+
- name: Run repoclosure on ELN SAP HANA
102+
run: |
103+
dnf5 repoclosure --newest --refresh --check eln-saphana --disablerepo=eln-extras --enablerepo=eln-saphana
104+
105+
close-issue-on-success:
106+
name: Report workflow success
107+
runs-on: ubuntu-latest
108+
needs:
109+
- eln-baseos
110+
- eln-extras
111+
- eln-crb
112+
- eln-appstream
113+
- eln-ha
114+
- eln-nfv
115+
- eln-rs
116+
- eln-rt
117+
- eln-sap
118+
- eln-saphana
119+
steps:
120+
- name: Checkout
121+
uses: actions/checkout@v4
122+
- name: Add a comment about successful job and close issue
123+
run: |
124+
set -e
125+
LABEL="repoclosure-failed"
126+
ISSUENO=$(gh issue list -l $LABEL | awk ' { print $1 } ' | head -n 1)
127+
if [ -n "$ISSUENO" ]; then
128+
MESSAGE="✅ The repoclosure CI job is now [successful](https://github.com/fedora-eln/eln/actions/runs/${{ github.run_id }}), closing issue."
129+
gh issue comment "${ISSUENO}" --body "${MESSAGE}"
130+
gh issue close "${ISSUENO}"
131+
fi
132+
env:
133+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134+
open-issue-on-failure:
135+
name: Report workflow failure
136+
runs-on: ubuntu-latest
137+
if: ${{ always() && (needs.eln-baseos.result=='failure' || needs.eln-extras.result=='failure' || needs.eln-crb.result=='failure' || needs.eln-appstream.result=='failure' || needs.eln-ha.result=='failure' || needs.eln-nfv.result=='failure' || needs.eln-rs.result=='failure' || needs.eln-rt.result=='failure' || needs.eln-sap.result=='failure' || needs.eln-saphana.result=='failure') }}
138+
needs:
139+
- eln-baseos
140+
- eln-extras
141+
- eln-crb
142+
- eln-appstream
143+
- eln-ha
144+
- eln-nfv
145+
- eln-rs
146+
- eln-rt
147+
- eln-sap
148+
- eln-saphana
149+
steps:
150+
- name: Checkout
151+
uses: actions/checkout@v4
152+
- name: Add a comment about failed job
153+
run: |
154+
set -e
155+
TITLE="Failed repoclosure job"
156+
LABEL="repoclosure-failed"
157+
ISSUENO=$(gh issue list -l $LABEL | awk ' { print $1 } ' | head -n 1)
158+
if [ -z "$ISSUENO" ]; then
159+
MESSAGE="❌ The repoclosure CI job failed. [Please investigate.](https://github.com/fedora-eln/eln/actions/runs/${{ github.run_id }})"
160+
gh issue create --title "${TITLE}" --body "${MESSAGE}" --label "${LABEL}"
161+
else
162+
MESSAGE="❌ The repoclosure CI job is still failing. [Please investigate.](https://github.com/fedora-eln/eln/actions/runs/${{ github.run_id }})"
163+
gh issue comment "${ISSUENO}" --body "${MESSAGE}"
164+
fi
165+
env:
166+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)