|
| 1 | +name: Post link to private end-to-end test repository |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + invite: |
| 9 | + name: Invite everyone to the e2e private repo |
| 10 | + if: | |
| 11 | + github.event.issue.pull_request |
| 12 | + && contains(github.event.comment.body, '/invite') |
| 13 | + runs-on: ubuntu-latest |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + collaborator: |
| 17 | + - LOGIN: kieferro |
| 18 | + PERMISSION: admin |
| 19 | + ENABLED: "true" |
| 20 | + |
| 21 | + - LOGIN: ewjoachim |
| 22 | + PERMISSION: admin |
| 23 | + ENABLED: "true" |
| 24 | + |
| 25 | + - LOGIN: ${{ github.event.issue.user.login }} |
| 26 | + PERMISSION: push |
| 27 | + ENABLED: ${{ !contains(fromJson('["kieferro", "ewjoachim"]'), github.event.issue.user.login) }} |
| 28 | + |
| 29 | + steps: |
| 30 | + |
| 31 | + - name: Invite @${{ matrix.collaborator.LOGIN }} to the e2e private repo |
| 32 | + run: gh api --method PUT /repos/mihcaojwe/python-coverage-comment-action-end-to-end-${NUMBER}-private/collaborators/${LOGIN} -f permission=${PERMISSION} |
| 33 | + if: ${{ matrix.collaborator.ENABLED == 'true' }} |
| 34 | + env: |
| 35 | + LOGIN: ${{ matrix.collaborator.LOGIN }} |
| 36 | + NUMBER: ${{ github.event.issue.number }} |
| 37 | + PERMISSION: ${{ matrix.collaborator.PERMISSION }} |
| 38 | + GITHUB_TOKEN: ${{ secrets.COVERAGE_COMMENT_E2E_GITHUB_TOKEN_USER_1 }} |
| 39 | + |
| 40 | + comment: |
| 41 | + name: Add comment with link to e2e repos |
| 42 | + if: | |
| 43 | + github.event.issue.pull_request |
| 44 | + && contains(github.event.comment.body, '/invite') |
| 45 | + runs-on: ubuntu-latest |
| 46 | + permissions: |
| 47 | + pull-requests: write |
| 48 | + steps: |
| 49 | + - run: | |
| 50 | + gh pr comment ${LINK} --body-file - <<EOF |
| 51 | + [End-to-end private repo](https://github.com/mihcaojwe/python-coverage-comment-action-end-to-end-${NUMBER}-private) |
| 52 | + In addition to repo admin, @${LOGIN} has been added to the private e2e repo |
| 53 | + EOF |
| 54 | + env: |
| 55 | + LINK: ${{ github.event.issue.html_url }} |
| 56 | + NUMBER: ${{ github.event.issue.number }} |
| 57 | + LOGIN: ${{ github.event.issue.user.login }} |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments