diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b82e233 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,10 @@ +# Before you create this pull request + +Thanks for your interest. This repository is a read-only mirror of a private repository and **we don't accept pull requests**. A workflow will close this PR automatically. + +Do this instead: + +- Cancel this PR. +- Report bugs, request features, or share feedback in the [Shopify dev community forums](https://community.shopify.dev/c/shopify-cli-libraries/14) + +For more details see [CONTRIBUTING.md](https://github.com/Shopify/shopify-app-python/blob/main/CONTRIBUTING.md). diff --git a/.github/workflows/close-external-prs.yml b/.github/workflows/close-external-prs.yml new file mode 100644 index 0000000..8f002de --- /dev/null +++ b/.github/workflows/close-external-prs.yml @@ -0,0 +1,64 @@ +name: Close External PRs + +on: + pull_request_target: + types: [opened, reopened] + +permissions: + pull-requests: write + +jobs: + close-external-pr: + runs-on: ubuntu-latest + steps: + - name: Check if PR author is from Shopify + id: check-author + uses: actions/github-script@v7 + with: + script: | + const author = context.payload.pull_request.user.login; + + try { + // Check if the author is a member of the Shopify organization + await github.rest.orgs.checkMembershipForUser({ + org: 'Shopify', + username: author + }); + + console.log(`${author} is a Shopify member`); + core.setOutput('is-shopify', 'true'); + } catch (error) { + console.log(`${author} is not a Shopify member or the check failed: ${error.message}`); + core.setOutput('is-shopify', 'false'); + } + + - name: Close PR and comment + if: steps.check-author.outputs.is-shopify == 'false' + uses: actions/github-script@v7 + with: + script: | + const prNumber = context.payload.pull_request.number; + + // Add comment to PR + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: `Thanks for your interest. This repository does not accept contributions, so we've closed this PR. + +To report a bug, request a feature, or share feedback, please post in the [Shopify dev community forums](https://community.shopify.dev/c/shopify-cli-libraries/14) + +We triage in the forums, not in this repo. PRs and issues here are closed without review. + +For more details see CONTRIBUTING.md` + }); + + // Close the PR + await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + state: 'closed' + }); + + console.log(`Closed PR #${prNumber} from external contributor`);