|
10 | 10 | - 'master'
|
11 | 11 | - 'main'
|
12 | 12 | merge_group:
|
13 |
| - |
14 | 13 | jobs:
|
15 |
| - call-check-cla: |
16 |
| - uses: dfinity/public-workflows/.github/workflows/check_cla.yml@main |
| 14 | + check-membership: |
| 15 | + uses: dfinity/public-workflows/.github/workflows/check_membership.yml@main |
17 | 16 | secrets: inherit
|
| 17 | + |
| 18 | + check-external-contributions: |
| 19 | + name: Check External Contributions |
| 20 | + runs-on: ubuntu-latest |
| 21 | + needs: check-membership |
| 22 | + if: ${{ needs.check-membership.outputs.is_member != 'true' && needs.check-membership.result == 'success' }} |
| 23 | + steps: |
| 24 | + - name: Create GitHub App Token |
| 25 | + uses: actions/create-github-app-token@v1 |
| 26 | + id: app-token |
| 27 | + with: |
| 28 | + app-id: ${{ vars.CLA_BOT_APP_ID }} |
| 29 | + private-key: ${{ secrets.CLA_BOT_PRIVATE_KEY }} |
| 30 | + |
| 31 | + - name: Checkout |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + repository: 'dfinity/public-workflows' |
| 35 | + |
| 36 | + - name: Python Setup |
| 37 | + uses: ./.github/workflows/python-setup |
| 38 | + |
| 39 | + - name: Check if accepting external contributions |
| 40 | + id: accepts_external_contrib |
| 41 | + run: | |
| 42 | + export PYTHONPATH="$PWD/reusable_workflows/" |
| 43 | + python reusable_workflows/check_membership/check_external_contrib.py |
| 44 | + shell: bash |
| 45 | + env: |
| 46 | + GH_TOKEN: ${{ github.token }} |
| 47 | + REPO: ${{ github.event.repository.name }} |
| 48 | + |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + ref: ${{ github.event.pull_request.head.ref }} |
| 53 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 54 | + |
| 55 | + - name: Close Pull Request |
| 56 | + id: close_pr |
| 57 | + if: ${{ steps.accepts_external_contrib.outputs.accepts_contrib != 'true' }} |
| 58 | + uses: superbrothers/close-pull-request@v3 |
| 59 | + with: |
| 60 | + comment: | |
| 61 | + Thank you for contributing! Unfortunately this repository does not accept external contributions yet. |
| 62 | +
|
| 63 | + We are working on enabling this by aligning our internal processes and our CI setup to handle external contributions. However this will take some time to set up so in the meantime we unfortunately have to close this Pull Request. |
| 64 | +
|
| 65 | + We hope you understand and will come back once we accept external PRs. |
| 66 | +
|
| 67 | + — The DFINITY Foundation""" |
| 68 | +
|
| 69 | + - name: Add Label |
| 70 | + uses: actions/github-script@v6 |
| 71 | + if: ${{ steps.accepts_external_contrib.outputs.accepts_contrib != 'false' }} |
| 72 | + with: |
| 73 | + script: | |
| 74 | + github.rest.issues.addLabels({ |
| 75 | + issue_number: context.issue.number, |
| 76 | + owner: context.repo.owner, |
| 77 | + repo: context.repo.repo, |
| 78 | + labels: ["external-contributor"] |
| 79 | + }) |
| 80 | +
|
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@v4 |
| 83 | + if: ${{ steps.accepts_external_contrib.outputs.accepts_contrib != 'false' }} |
| 84 | + with: |
| 85 | + repository: 'dfinity/public-workflows' |
| 86 | + |
| 87 | + - name: Check CLA |
| 88 | + id: check-cla |
| 89 | + run: | |
| 90 | + export PYTHONPATH="$PWD/reusable_workflows/" |
| 91 | + python reusable_workflows/check_cla/check_cla_pr.py |
| 92 | + shell: bash |
| 93 | + if: ${{ steps.accepts_external_contrib.outputs.accepts_contrib != 'false' }} |
| 94 | + env: |
| 95 | + GH_ORG: ${{ github.repository_owner }} |
| 96 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 97 | + REPO: ${{ github.event.repository.name }} |
| 98 | + PR_ID: ${{ github.event.number }} |
0 commit comments