From a9ca80e4903e9d43b736c653ef044307ab96cc0b Mon Sep 17 00:00:00 2001 From: AnimeGitB Date: Wed, 7 Sep 2022 15:38:27 +0930 Subject: [PATCH] Forbid PRs from modifying certain files --- .github/workflows/protect_files.yml | 23 +++++++++++++++++++++++ CONTRIBUTING.md | 1 + 2 files changed, 24 insertions(+) create mode 100644 .github/workflows/protect_files.yml diff --git a/.github/workflows/protect_files.yml b/.github/workflows/protect_files.yml new file mode 100644 index 000000000..a34895ce0 --- /dev/null +++ b/.github/workflows/protect_files.yml @@ -0,0 +1,23 @@ +name: Protect write-access files from being PR'd + +on: + pull_request_target: + types: + - opened + - reopened + branches: + - development + paths: + - '.github/' + - '.editorconfig' + - 'CODE_OF_CONDUCT.md' + - 'CONTRIBUTING.md' + - 'LICENSE' + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: "This PR has been closed for modifying protected files. See `CONTIBUTING.md` for more information." \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e202898dc..fd62b1de7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,3 +21,4 @@ Your code should follow the standards set below: - Dependencies that use a separate language (ex. Kotlin) that can run on a JVM are acceptable. - Dependencies that require the use of native code (ex. JNI) are prohibited. - Directly adding foreign code (other languages, ex. Kotlin) into the main codebase is prohibited. +- Certain files and folders are forbidden to modify in Pull Requests and may only be changed by Write-Access members. The current list for this can be found in `.github/workflows/protect_files.yml`. \ No newline at end of file