Skip to content

Commit 4bd8d5e

Browse files
committed
Instead of deleting e2e repo when tests succeed, delete them when PR closes
1 parent 0325d3e commit 4bd8d5e

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

.github/workflows/e2e-delete-repo.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Delete end-to-end test repos on PR close
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- closed
7+
8+
jobs:
9+
test:
10+
name: Publish coverage comment
11+
runs-on: ubuntu-latest
12+
steps:
13+
- run: |
14+
gh repo delete --yes https://github.com/mihcaojwe/python-coverage-comment-action-end-to-end-${NUMBER}-public || true
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.COVERAGE_COMMENT_E2E_GITHUB_TOKEN_USER_1 }}
17+
- run: |
18+
gh repo delete --yes https://github.com/mihcaojwe/python-coverage-comment-action-end-to-end-${NUMBER}-private || true
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.COVERAGE_COMMENT_E2E_GITHUB_TOKEN_USER_2 }}

tests/end_to_end/conftest.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -294,19 +294,15 @@ def f(*args):
294294

295295
yield f
296296

297-
if not is_failed():
298-
gh_delete_repo(gh_me)
299-
300-
else:
301-
for username, permission in team_users_permissions.items():
302-
gh_me(
303-
"api",
304-
"--method",
305-
"PUT",
306-
f"/repos/{{owner}}/{{repo}}/collaborators/{username}",
307-
"-f",
308-
f"permission={permission}",
309-
)
297+
for username, permission in team_users_permissions.items():
298+
gh_me(
299+
"api",
300+
"--method",
301+
"PUT",
302+
f"/repos/{{owner}}/{{repo}}/collaborators/{username}",
303+
"-f",
304+
f"permission={permission}",
305+
)
310306

311307

312308
@pytest.fixture
@@ -321,8 +317,6 @@ def f():
321317
gh_other("repo", "fork", "--clone", f"{gh_me_username}/{repo_name}", "--", ".")
322318

323319
yield f
324-
if not is_failed():
325-
gh_delete_repo(gh_other)
326320

327321

328322
@pytest.fixture

0 commit comments

Comments
 (0)