From 145d1aee731c3d94e1a81a44282d7b92a0f085a5 Mon Sep 17 00:00:00 2001 From: Remko Date: Thu, 21 Nov 2024 16:46:57 +0100 Subject: [PATCH] added workflows --- .../pull-request-from-branch-check.yaml | 18 +++++++++++++++++ .../workflows/pull-request-lint-check.yaml | 20 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/pull-request-from-branch-check.yaml create mode 100644 .github/workflows/pull-request-lint-check.yaml diff --git a/.github/workflows/pull-request-from-branch-check.yaml b/.github/workflows/pull-request-from-branch-check.yaml new file mode 100644 index 00000000..a40f09fa --- /dev/null +++ b/.github/workflows/pull-request-from-branch-check.yaml @@ -0,0 +1,18 @@ +name: Main Branch Protection + +on: + pull_request: + branches: + - master + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Check branch + run: | + if [[ ${GITHUB_HEAD_REF} != development ]] && [[ ${GITHUB_HEAD_REF} != documentation ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]]; + then + echo "Error: Pull request must come from 'development', 'documentation' or 'hotfix/' branch" + exit 1 + fi diff --git a/.github/workflows/pull-request-lint-check.yaml b/.github/workflows/pull-request-lint-check.yaml new file mode 100644 index 00000000..0c04e87a --- /dev/null +++ b/.github/workflows/pull-request-lint-check.yaml @@ -0,0 +1,20 @@ +name: Lint Check + +on: + pull_request: + branches: + - never + +jobs: + lint-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install dependencies + run: npm i + + - name: Linting + run: npm run lint