From 4e7581928c53736e1cc586e2ce763cbebf21c774 Mon Sep 17 00:00:00 2001 From: Richard Powell Date: Thu, 8 Jan 2026 09:56:09 -0500 Subject: [PATCH 1/2] Add initial github action and PR template --- .github/PULL_REQUEST_TEMPLATE.md | 10 ++++ .github/workflows/close-external-prs.yml | 64 ++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/close-external-prs.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..7b3f10b --- /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. We don’t accept contributions to this package. **We don't accept pull requests here**. 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..1a1f10e --- /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`); + 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`); From 42f5635339b75693a758237cf377abc85c97b072 Mon Sep 17 00:00:00 2001 From: Richard Powell Date: Thu, 8 Jan 2026 10:02:49 -0500 Subject: [PATCH 2/2] Minor tweaks --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/close-external-prs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7b3f10b..b82e233 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ # Before you create this pull request -Thanks for your interest. This repository is a read-only mirror of a private repository. We don’t accept contributions to this package. **We don't accept pull requests here**. A workflow will close this PR automatically. +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: diff --git a/.github/workflows/close-external-prs.yml b/.github/workflows/close-external-prs.yml index 1a1f10e..8f002de 100644 --- a/.github/workflows/close-external-prs.yml +++ b/.github/workflows/close-external-prs.yml @@ -28,7 +28,7 @@ jobs: console.log(`${author} is a Shopify member`); core.setOutput('is-shopify', 'true'); } catch (error) { - console.log(`${author} is not a Shopify member`); + console.log(`${author} is not a Shopify member or the check failed: ${error.message}`); core.setOutput('is-shopify', 'false'); }