Skip to content

Commit 27f3a18

Browse files
author
Yi He
committed
ci: split workflow file to avoid issue
1 parent 9df6e6f commit 27f3a18

2 files changed

Lines changed: 136 additions & 23 deletions

File tree

.github/workflows/comment-ci.yaml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
name: CI Test
3+
4+
on:
5+
issue_comment:
6+
types: [created]
7+
8+
jobs:
9+
check-pull-request:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.event.issue.pull_request &&
12+
(endsWith(github.event.comment.body, '/test')) }}
13+
steps:
14+
- name: Query author repository permissions
15+
uses: octokit/request-action@v2.x
16+
id: user_permission
17+
with:
18+
route: GET /repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}/permission
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Check if user does have correct permissions
23+
if: contains('admin write', fromJson(steps.user_permission.outputs.data).permission)
24+
id: check_user_perm
25+
run: |
26+
echo "User '${{ github.event.sender.login }}' has permission '${{ fromJson(steps.user_permission.outputs.data).permission }}' allowed values: 'admin', 'write'"
27+
echo "allowed_user=true" >> $GITHUB_OUTPUT
28+
29+
- name: Get information for pull request
30+
uses: octokit/request-action@v2.x
31+
id: pr-api
32+
with:
33+
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
outputs:
38+
allowed_user: ${{ steps.check_user_perm.outputs.allowed_user }}
39+
sha: ${{ fromJson(steps.pr-api.outputs.data).head.sha }}
40+
ref: ${{ fromJson(steps.pr-api.outputs.data).head.ref }}
41+
repo_url: ${{ fromJson(steps.pr-api.outputs.data).head.repo.html_url }}
42+
43+
centos-10-bootc:
44+
needs: check-pull-request
45+
if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }}
46+
continue-on-error: true
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- name: Run the tests
51+
uses: sclorg/testing-farm-as-github-action@v3.1.2
52+
with:
53+
compose: CentOS-Stream-10
54+
api_key: ${{ secrets.TF_API_KEY }}
55+
git_url: ${{ needs.check-pull-request.outputs.repo_url }}
56+
git_ref: ${{ needs.check-pull-request.outputs.ref }}
57+
update_pull_request_status: true
58+
pull_request_status_name: centos-10-bootc
59+
tmt_context: "arch=x86_64;distro=cs-10"
60+
tmt_plan_regex: bootc
61+
tf_scope: private
62+
variables: "ARCH=x86_64"
63+
timeout: 90
64+
secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"
65+
66+
fedora-43-bootc:
67+
needs: check-pull-request
68+
if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }}
69+
continue-on-error: true
70+
runs-on: ubuntu-latest
71+
72+
steps:
73+
- name: Run the tests
74+
uses: sclorg/testing-farm-as-github-action@v3.1.2
75+
with:
76+
compose: Fedora-43
77+
api_key: ${{ secrets.TF_API_KEY }}
78+
git_url: ${{ needs.check-pull-request.outputs.repo_url }}
79+
git_ref: ${{ needs.check-pull-request.outputs.ref }}
80+
update_pull_request_status: true
81+
pull_request_status_name: fedora-43-bootc
82+
tmt_context: "arch=x86_64;distro=fedora-43"
83+
tmt_plan_regex: bootc
84+
tf_scope: private
85+
variables: "ARCH=x86_64"
86+
timeout: 90
87+
secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"
88+
89+
fedora-44-bootc:
90+
needs: check-pull-request
91+
if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }}
92+
continue-on-error: true
93+
runs-on: ubuntu-latest
94+
95+
steps:
96+
- name: Run the tests
97+
uses: sclorg/testing-farm-as-github-action@v3.1.2
98+
with:
99+
compose: Fedora-Rawhide
100+
api_key: ${{ secrets.TF_API_KEY }}
101+
git_url: ${{ needs.check-pull-request.outputs.repo_url }}
102+
git_ref: ${{ needs.check-pull-request.outputs.ref }}
103+
update_pull_request_status: true
104+
pull_request_status_name: fedora-44-bootc
105+
tmt_context: "arch=x86_64;distro=fedora-44"
106+
tmt_plan_regex: bootc
107+
tf_scope: private
108+
variables: "ARCH=x86_64"
109+
timeout: 90
110+
secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"
111+
112+
centos-9-ostree:
113+
needs: check-pull-request
114+
if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }}
115+
continue-on-error: true
116+
runs-on: ubuntu-latest
117+
118+
steps:
119+
- name: Run the tests
120+
uses: sclorg/testing-farm-as-github-action@v3.1.2
121+
with:
122+
compose: CentOS-Stream-9
123+
api_key: ${{ secrets.TF_API_KEY }}
124+
git_url: ${{ needs.check-pull-request.outputs.repo_url }}
125+
git_ref: ${{ needs.check-pull-request.outputs.ref }}
126+
update_pull_request_status: true
127+
pull_request_status_name: centos-9-ostree
128+
tmt_context: "arch=x86_64;distro=cs-9"
129+
tmt_plan_regex: ostree
130+
tf_scope: private
131+
variables: "ARCH=x86_64"
132+
timeout: 90
133+
secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}"

.github/workflows/greenboot-ci.yaml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,31 @@ name: CI Test
44
on:
55
pull_request_target:
66
types: [opened, synchronize, reopened]
7-
issue_comment:
8-
types: [created]
97

108
jobs:
119
check-pull-request:
12-
if: |
13-
github.event_name == 'pull_request_target' ||
14-
(
15-
github.event_name == 'issue_comment' &&
16-
github.event.issue.pull_request &&
17-
endsWith(github.event.comment.body, '/test')
18-
)
1910
runs-on: ubuntu-latest
2011
steps:
21-
- name: Set PR author
22-
id: set-author
23-
run: |
24-
if [ "${{ github.event_name }}" == "pull_request_target" ]; then
25-
echo "AUTHOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
26-
echo "PR_NUM=${{ github.event.number }}" >> $GITHUB_ENV
27-
else
28-
echo "AUTHOR=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
29-
echo "PR_NUM=${{ github.event.issue.number }}" >> $GITHUB_ENV
30-
fi
31-
3212
- name: Query author repository permissions
3313
uses: octokit/request-action@v2.x
3414
id: user_permission
3515
with:
36-
route: GET /repos/${{ github.repository }}/collaborators/${{ env.AUTHOR }}/permission
16+
route: GET /repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}/permission
3717
env:
3818
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3919

4020
- name: Check if user does have correct permissions
4121
if: contains('admin write', fromJson(steps.user_permission.outputs.data).permission)
4222
id: check_user_perm
4323
run: |
44-
echo "User '${{ env.AUTHOR }}' has permission '${{ fromJson(steps.user_permission.outputs.data).permission }}' allowed values: 'admin', 'write'"
24+
echo "User '${{ github.event.sender.login }}' has permission '${{ fromJson(steps.user_permission.outputs.data).permission }}' allowed values: 'admin', 'write'"
4525
echo "allowed_user=true" >> $GITHUB_OUTPUT
4626
4727
- name: Get information for pull request
4828
uses: octokit/request-action@v2.x
4929
id: pr-api
5030
with:
51-
route: GET /repos/${{ github.repository }}/pulls/${{ env.PR_NUM }}
31+
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.number }}
5232
env:
5333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5434

0 commit comments

Comments
 (0)