]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
close pull requests from forks' stable and staging (#42456)
authorqwerltaz <69696513+qwerltaz@users.noreply.github.com>
Sun, 18 Jan 2026 09:37:12 +0000 (10:37 +0100)
committerGitHub <noreply@github.com>
Sun, 18 Jan 2026 09:37:12 +0000 (09:37 +0000)
* close on master workflow: add stable and staging to blacklist, tweak wording, update commented out text

* keep main and develop in blacklist

* critical grammar and formatting

* argh how even (bring back old version of commented-out section)

* thats not the right word

* only close when head repo is a fork

from github docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=opened#pull_request

.github/workflows/close-master-pr.yml

index 42e512d556f47bf96c1333fe1dc7479751782232..4a1f02c3a720dfe7d32b41daf43f465dc43b9966 100644 (file)
@@ -3,19 +3,20 @@ name: Close PRs on master
 on:
   pull_request_target:
     types: [ opened, ready_for_review ]
-    
+
 jobs:
   run:
     runs-on: ubuntu-latest
-    if: ${{github.head_ref == 'master' || github.head_ref == 'main' || github.head_ref == 'develop'}}
-    
-    steps:    
+    if: ${{(github.head_ref == 'master' || github.head_ref == 'main' || github.head_ref == 'develop' || github.head_ref == 'stable' || github.head_ref == 'staging')
+        && github.event.pull_request.head.repo.fork}}
+
+    steps:
     - uses: superbrothers/close-pull-request@v3
       with:
-        comment: "Thank you for your contribution! It appears you created a PR from your master branch, this is [something you should avoid doing](https://jmeridth.com/posts/do-not-issue-pull-requests-from-your-master-branch/), and thus this PR has been automatically closed. \n \n We suggest you follow [our git usage documentation](https://docs.spacestation14.com/en/general-development/setup/git-for-the-ss14-developer.html). \n \n You can move your current work from the master branch to another branch by following [these commands](https://ohshitgit.com/#accidental-commit-master). And then you may recreate your PR using the new branch."
+        comment: "Thank you for your contribution! It appears you created a pull request from the master branch or another main development branch. This is [something you should avoid doing](https://jmeridth.com/posts/do-not-issue-pull-requests-from-your-master-branch/), and thus this pull request has been automatically closed. \n \n We suggest you follow [our git usage documentation](https://docs.spacestation14.com/en/general-development/setup/git-for-the-ss14-developer.html). \n \n You can move your current work to another branch by following [these commands](https://ohshitgit.com/#accidental-commit-master). Then, you may recreate your pull request using the new branch."
+
+    # If you prefer to just comment on the pr and not close it, uncomment the below and comment the above
 
-    # If you prefer to just comment on the pr and not close it, uncomment the bellow and comment the above
-      
     # - uses: actions/github-script@v7
     #   with:
     #     script: |
@@ -23,5 +24,4 @@ jobs:
     #         issue_number: ${{ github.event.number }},
     #         owner: context.repo.owner,
     #         repo: context.repo.repo,
-    #         body: "Thank you for contributing to the Space Station 14 repository. Unfortunately, it looks like you submitted your pull request from the master branch. We suggest you follow [our git usage documentation](https://docs.spacestation14.com/en/general-development/setup/git-for-the-ss14-developer.html) \n\n You can move your current work from the master branch to another branch by doing `git branch <branch_name` and resetting the master branch. \n\n This pr won't be automatically closed. However, a maintainer may close it for this reason."
-    #       })
+    #         body: "Thank you for your contribution! It appears you created a pull request from the master branch or another main development branch. This is [something you should avoid doing](https://jmeridth.com/posts/do-not-issue-pull-requests-from-your-master-branch/)\n\nYou can move your current work to another branch by following [these commands](https://ohshitgit.com/#accidental-commit-master). Then, you may recreate your pull request using the new branch. \n\n This pull request won't be automatically closed. However, a maintainer may close it for this reason."})