diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 8bc6d15..7634fc5 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -71,6 +71,20 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + edits: + runs-on: ubuntu-latest + name: Check if PR is editable + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Install dependencies if needed + run: make init + + - name: Run the check + run: python3 -m scripts.check.edits + + hassfest: runs-on: ubuntu-latest name: "Check hassfest" diff --git a/scripts/check/edits.py b/scripts/check/edits.py new file mode 100644 index 0000000..0a8210f --- /dev/null +++ b/scripts/check/edits.py @@ -0,0 +1,15 @@ +import asyncio + +from scripts.helpers.event import get_event + + +async def check(): + event = get_event() + pull_request = event["pull_request"] + if not pull_request["maintainer_can_modify"]: + if pull_request["head"]["repo"]["full_name"] != "hacs/default": + exit("::error::The PR is not editable by HACS maintainers") + + +if __name__ == "__main__": + asyncio.get_event_loop().run_until_complete(check())