Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

feat: добавление правила для защищенной ветки #46

feat: добавление правила для защищенной ветки

feat: добавление правила для защищенной ветки #46

Workflow file for this run

name: Test on Pull Request
on:
pull_request:
types:
- opened
- synchronize
jobs:
checkout:
runs-on: front
steps:
- name: Set up unique workspace
id: setup_workspace
run: |
workspace_path="${{ github.workspace }}/${{ github.event.pull_request.number }}"
echo "Using workspace path: $workspace_path"
- name: Custom Checkout
run: |
if [ -d $workspace_path ]; then
echo "Fetching repository changes"
cd $workspace_path
git fetch origin ${{ github.event.pull_request.head.ref }} --depth 1
git reset --hard FETCH_HEAD
else
echo "Cloning repository"
git clone --branch ${{ github.event.pull_request.head.ref }} --depth 1 [email protected]:${{ github.repository }} ${{ steps.setup_workspace.outputs.workspace }}
fi
setup:
runs-on: front
needs: checkout
steps:
- name: Install dependencies
working-directory: $workspace_path
run: yarn
tests:
runs-on: front
needs: setup
steps:
- name: Run tests
working-directory: $workspace_path
run: yarn test
eslint:
runs-on: front
needs: setup
steps:
- name: Run eslint
working-directory: $workspace_path
run: yarn eslint
tslint:
runs-on: front
needs: setup
steps:
- name: Run tslint
working-directory: $workspace_path
run: yarn tslint
prettier:
runs-on: front
needs: setup
steps:
- name: Run prettier
working-directory: $workspace_path
run: yarn prettier
protect:
runs-on: front
needs: [tests, eslint, tslint, prettier]
steps:
- name: Protect branch
run: echo "Branch is protected"
cleanup:
runs-on: front
needs: protect
if: github.event_name == 'pull_request' && github.event.action == 'closed'
steps:
- name: Clean up workspace
run: rm -rf $workspace_path