File tree 5 files changed +43
-4
lines changed
5 files changed +43
-4
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ # stdlib
4
+ import os
5
+ import sys
6
+
7
+ # 3rd party
8
+ from github3 import GitHub
9
+ from github3 .repos import Repository
10
+ from packaging .version import InvalidVersion , Version
11
+
12
+ latest_tag = os .environ ["GITHUB_REF_NAME" ]
13
+
14
+ try :
15
+ current_version = Version (latest_tag )
16
+ except InvalidVersion :
17
+ sys .exit ()
18
+
19
+ gh : GitHub = GitHub (token = os .environ ["GITHUB_TOKEN" ])
20
+ repo : Repository = gh .repository (* os .environ ["GITHUB_REPOSITORY" ].split ('/' , 1 ))
21
+
22
+ for milestone in repo .milestones (state = "open" ):
23
+ try :
24
+ milestone_version = Version (milestone .title )
25
+ except InvalidVersion :
26
+ continue
27
+ if milestone_version == current_version :
28
+ sys .exit (not milestone .update (state = "closed" ))
Original file line number Diff line number Diff line change 13
13
14
14
permissions :
15
15
actions : write
16
+ issues : write
16
17
contents : read
17
18
18
19
jobs :
Original file line number Diff line number Diff line change 14
14
15
15
permissions :
16
16
actions : write
17
+ issues : write
17
18
contents : read
18
19
19
20
jobs :
@@ -139,21 +140,21 @@ jobs:
139
140
140
141
- name : Setup Python 🐍
141
142
uses : " actions/setup-python@v2"
143
+ if : startsWith(github.ref, 'refs/tags/')
142
144
with :
143
145
python-version : 3.8
144
- if : startsWith(github.ref, 'refs/tags/')
145
146
146
147
- name : Install dependencies 🔧
148
+ if : startsWith(github.ref, 'refs/tags/')
147
149
run : |
148
150
python -m pip install --upgrade pip setuptools wheel
149
151
python -m pip install --upgrade tox
150
- if : startsWith(github.ref, 'refs/tags/')
151
152
152
153
- name : Build distributions 📦
154
+ if : startsWith(github.ref, 'refs/tags/')
153
155
run : |
154
156
tox -e build
155
157
156
- if : startsWith(github.ref, 'refs/tags/')
157
158
158
159
- name : Upload distribution to PyPI 🚀
159
160
if : startsWith(github.ref, 'refs/tags/')
@@ -162,3 +163,11 @@ jobs:
162
163
user : __token__
163
164
password : ${{ secrets.PYPI_TOKEN }}
164
165
skip_existing : true
166
+
167
+ - name : Close milestone 🚪
168
+ if : startsWith(github.ref, 'refs/tags/')
169
+ run : |
170
+ python -m pip install --upgrade github3.py packaging
171
+ python milestones.py
172
+ env :
173
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 13
13
14
14
permissions :
15
15
actions : write
16
+ issues : write
16
17
contents : read
17
18
18
19
jobs :
Original file line number Diff line number Diff line change 67
67
- --keep-runtime-typing
68
68
69
69
- repo : https://github.com/Lucas-C/pre-commit-hooks
70
- rev : v1.1.10
70
+ rev : v1.1.11
71
71
hooks :
72
72
- id : remove-crlf
73
73
- id : forbid-crlf
You can’t perform that action at this time.
0 commit comments