-
Notifications
You must be signed in to change notification settings - Fork 84
135 lines (122 loc) · 5.12 KB
/
member_validations.yml
File metadata and controls
135 lines (122 loc) · 5.12 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Member validations
on:
workflow_dispatch:
pull_request_review:
types: [ submitted ]
pull_request:
types: [ opened, reopened, ready_for_review, synchronize]
paths:
- '**.toml'
jobs:
validate_candidate:
name: Validate member update or new candidate
if: >
{{ contains(github.event.pull_request.labels.*.name, 'member update') || (
contains(github.event.pull_request.head.ref, 'submission')
&&
contains(github.event.pull_request.labels.*.name, 'submission')
)
}}
runs-on: ubuntu-latest
env:
python-version: "3.13"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- uses: actions/checkout@v6
- name: Checkout PR
run: |
gh pr checkout ${{ github.event.pull_request.number }}
git config --local user.email "qiskit-bot@users.noreply.github.com"
git config --local user.name "qiskit-bot"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Fetch member id
id: get-id
run: |
id=$(echo ${{ github.event.pull_request.head.ref }} | cut -d- -f2 )
echo "id=$id" >> $GITHUB_OUTPUT
- name: Find Comment bot comment
uses: peter-evans/find-comment@v4
if: always()
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Check out the logs
- name: Initial validatation
run: python manager.py ci validate_member ${{ steps.get-id.outputs.id }}
- name: Create sections
if: github.event.pull_request.draft == false
run: python manager.py ci create_sections ${{ steps.get-id.outputs.id }}
- name: Section validatation
run: python manager.py ci validate_member ${{ steps.get-id.outputs.id }}
- name: Commit sections
if: success()
run: |
if git diff --exit-code; then
echo "No new sections to commit"
else
git commit -am "Update sections" --allow-empty
- name: Fetch data
if: github.event.pull_request.draft == false
run: python manager.py ci update_member_data ${{ steps.get-id.outputs.id }}
- name: Data validatation
run: python manager.py ci validate_member ${{ steps.get-id.outputs.id }}
- name: Commit data
if: success()
run: |
if git diff --exit-code; then
echo "No new data to commit"
else
git commit -am "Update data" --allow-empty
- name: Create badge
if: github.event.review.state == 'approved'
env:
BITLY_TOKEN: ${{ secrets.BITLY_TOKEN }}
run: python manager.py members update_badge
- name: Commit badge
if: success()
run: |
if git diff --exit-code; then
echo "No badge to commit"
else
git commit -am "Update badge" --allow-empty
- name: Push sections
if: always()
run: git push --verbose
- name: Make comment on validated submission
if: success() && steps.cpr.outputs.pull-request-number
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.issue.number }}
token: ${{ secrets.GITHUB_TOKEN }}
edit-mode: replace
body: |
Thanks for your submission! :white_check_mark:
Let's close this issue in favor of the PR #${{ steps.cpr.outputs.pull-request-number }}. We can move the conversation about this project there.
> [!IMPORTANT]
> **The submitted project is not yet approved**. It will be once PR #${{ steps.cpr.outputs.pull-request-number }} is reviewed and merged.
> You can still make changes as code comments in that PR.
<sub>Curious about the submission validation? [Check out the logs here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}).</sub>
- name: Make comment on failed submission
if: failure()
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
body: |
The submission failed :x:
[Check out the logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}).
> [!TIP]
> To edit the submission and try to fix the problem with the data validation, review the PR and use
> `Add a suggestion` option:
> <img width="383" height="155" src="https://github.com/user-attachments/assets/ce2fe037-58e7-4dae-a737-0c065a447c8b" />
> The validation will re-run automatically after that.