|
| 1 | +name: License Change Notice |
| 2 | + |
| 3 | +# The project is transitioning from LGPL-2.1 to Apache 2.0 |
| 4 | +# (https://github.com/python-zeroconf/python-zeroconf/issues/1835). |
| 5 | +# Every newly opened pull request gets a comment stating that opening |
| 6 | +# it means agreeing to license the contribution, and the author's |
| 7 | +# previous contributions, under Apache 2.0. If the pull request author |
| 8 | +# replies that they do not agree, the pull request is closed. |
| 9 | + |
| 10 | +on: |
| 11 | + pull_request_target: |
| 12 | + types: |
| 13 | + - opened |
| 14 | + issue_comment: |
| 15 | + types: |
| 16 | + - created |
| 17 | + |
| 18 | +permissions: |
| 19 | + pull-requests: write |
| 20 | + issues: write |
| 21 | + |
| 22 | +jobs: |
| 23 | + notice: |
| 24 | + name: Post license notice |
| 25 | + if: > |
| 26 | + github.event_name == 'pull_request_target' && |
| 27 | + github.event.pull_request.user.type != 'Bot' |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 31 | + with: |
| 32 | + script: | |
| 33 | + await github.rest.issues.createComment({ |
| 34 | + owner: context.repo.owner, |
| 35 | + repo: context.repo.repo, |
| 36 | + issue_number: context.payload.pull_request.number, |
| 37 | + body: [ |
| 38 | + "Thanks for contributing! A quick note: this project is in the process of moving from LGPL-2.1 to Apache 2.0, see #1835.", |
| 39 | + "", |
| 40 | + "By continuing with this pull request you are okay with your contribution, and your previous contributions to this repository, being offered under Apache 2.0.", |
| 41 | + "", |
| 42 | + "If that does not work for you, no hard feelings; reply with the exact phrase `I do not agree to the Apache 2.0 license` or simply close this pull request, and nothing of yours will be included in the change.", |
| 43 | + ].join("\n"), |
| 44 | + }); |
| 45 | +
|
| 46 | + objection: |
| 47 | + name: Close on objection |
| 48 | + if: > |
| 49 | + github.event_name == 'issue_comment' && |
| 50 | + github.event.issue.pull_request && |
| 51 | + github.event.comment.user.login == github.event.issue.user.login && |
| 52 | + contains(github.event.comment.body, 'I do not agree to the Apache 2.0 license') |
| 53 | + runs-on: ubuntu-latest |
| 54 | + steps: |
| 55 | + - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 56 | + with: |
| 57 | + script: | |
| 58 | + const number = context.payload.issue.number; |
| 59 | + await github.rest.issues.createComment({ |
| 60 | + owner: context.repo.owner, |
| 61 | + repo: context.repo.repo, |
| 62 | + issue_number: number, |
| 63 | + body: "Closing as requested; this contribution is not offered under the Apache 2.0 license change.", |
| 64 | + }); |
| 65 | + await github.rest.pulls.update({ |
| 66 | + owner: context.repo.owner, |
| 67 | + repo: context.repo.repo, |
| 68 | + pull_number: number, |
| 69 | + state: "closed", |
| 70 | + }); |
0 commit comments