From 813a37592d8207a739e10b51effcde3422187973 Mon Sep 17 00:00:00 2001 From: "Rodrigo Q. Saramago" Date: Wed, 19 Oct 2022 09:28:58 -0300 Subject: [PATCH] =?UTF-8?q?Add=20action=20to=20welcome=20external=20contri?= =?UTF-8?q?butors=20with=20the=20contributing=20guidelines=20Co-authored-b?= =?UTF-8?q?y:=20Kamil=20=C5=9Aliwak=20=20Co-aut?= =?UTF-8?q?hored-by:=20Nuno=20Santos=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/welcome-external-pr.yml | 66 +++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/welcome-external-pr.yml diff --git a/.github/workflows/welcome-external-pr.yml b/.github/workflows/welcome-external-pr.yml new file mode 100644 index 000000000000..1a034ffff34f --- /dev/null +++ b/.github/workflows/welcome-external-pr.yml @@ -0,0 +1,66 @@ +name: External contributor greeter + +on: + pull_request_target: + types: + - opened + - reopened + +env: + ORGANIZATION: Ethereum + DRY_RUN: false + +jobs: + comment-external-pr: + runs-on: ubuntu-latest + steps: + - name: Get organization members + id: get_members + env: + GH_TOKEN: ${{ secrets.READ_ORG }} + CONTRIBUTOR: ${{ github.event.pull_request.user.login }} + run: | + gh api graphql \ + --raw-field organization="$ORGANIZATION" \ + --raw-field query=' + query($organization: String!, $cursor: String) { + organization(login: $organization) { + membersWithRole(first: 100, after: $cursor) { + pageInfo { + hasNextPage, + endCursor + } + nodes { + login + } + } + } + }' > org_members.json + echo "CONTRIBUTOR_IS_ORG_MEMBER=$( + jq \ + --arg contributor $CONTRIBUTOR \ + '.data.organization.membersWithRole | any(.nodes[].login; . == $contributor)' \ + org_members.json + )" >> $GITHUB_OUTPUT + + - name: Comment on external contribution PR + if: ${{ steps.get_members.outputs.CONTRIBUTOR_IS_ORG_MEMBER == 'false' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR: ${{ github.event.pull_request.html_url }} + run: | + echo "Commenting in a newly submitted or reopened external PR: $PR" + if [[ $DRY_RUN == 'false' ]]; then + gh pr edit "$PR" --add-label "external contribution :star:" + comment_body=( + "Thank you for your contribution to the Solidity compiler! A team member will follow up shortly." + "\n\n" + "If you haven't read our [contributing guidelines](https://docs.soliditylang.org/en/latest/contributing.html) and our " + "[review checklist](https://github.com/ethereum/solidity/blob/develop/ReviewChecklist.md) before, " + "please do it now, this makes the reviewing process and accepting your contribution smoother." + "\n\n" + "If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the " + "[#solidity-dev](https://matrix.to/#/#ethereum_solidity-dev:gitter.im) channel on Matrix." + ) + gh pr comment $PR --body "$(IFS='' ; echo -e "${comment_body[*]}")" + fi