-
Notifications
You must be signed in to change notification settings - Fork 32
57 lines (50 loc) · 1.9 KB
/
e2e-private-link-in-pr.yml
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
name: Post link to private end-to-end test repository
on:
issue_comment:
types: [created]
jobs:
invite:
name: Invite everyone to the e2e private repo
if: |
github.event.issue.pull_request
&& contains(github.event.comment.body, '/invite')
runs-on: ubuntu-latest
strategy:
matrix:
collaborator:
- LOGIN: kieferro
PERMISSION: admin
ENABLED: true
- LOGIN: ewjoachim
PERMISSION: admin
ENABLED: true
- LOGIN: ${{ github.event.issue.user.login }}
PERMISSION: push
ENABLED: ${{ !contains(fromJson('["kieferro", "ewjoachim"]'), github.event.issue.user.login) }}
steps:
- name: Invite @${{ matrix.collaborator.LOGIN }} to the e2e private repo
run: gh api --method PUT /repos/mihcaojwe/python-coverage-comment-action-end-to-end-${NUMBER}-private/collaborators/${LOGIN} -f permission=${PERMISSION}
if: ${{ matrix.collaborator.ENABLED == true }}
env:
LOGIN: ${{ matrix.collaborator.LOGIN }}
NUMBER: ${{ github.event.issue.number }}
PERMISSION: ${{ matrix.collaborator.PERMISSION }}
GITHUB_TOKEN: ${{ secrets.COVERAGE_COMMENT_E2E_GITHUB_TOKEN_USER_1 }}
comment:
name: Add comment with link to e2e repos
if: |
github.event.issue.pull_request
&& contains(github.event.comment.body, '/invite')
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- run: |
gh pr comment ${LINK} --body-file - <<EOF
[End-to-end private repo](https://github.com/mihcaojwe/python-coverage-comment-action-end-to-end-${NUMBER}-private)
EOF
env:
LINK: ${{ github.event.issue.html_url }}
NUMBER: ${{ github.event.issue.number }}
LOGIN: ${{ github.event.issue.user.login }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}