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

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

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

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

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 and checkout
id: setup_workspace
run: |
workspace_path="${{ github.workspace }}/${{ github.event.pull_request.number }}"
echo "Using workspace path: $workspace_path"
echo "workspace_path=$workspace_path" >> $GITHUB_ENV
if [ -e "$workspace_path/.git" ]; 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 }} $workspace_path
fi
setup:
runs-on: front
needs: checkout
steps:
- name: Install dependencies
run: |
echo ${{ needs.checkout.outputs.workspace_path }}
cd ${{ needs.checkout.outputs.workspace_path }}
yarn
tests:
runs-on: front
needs: setup
steps:
- name: Run tests
run: cd ${{ needs.checkout.outputs.workspace_path }} && yarn test
eslint:
runs-on: front
needs: setup
steps:
- name: Run eslint
run: cd ${{ needs.checkout.outputs.workspace_path }} && yarn eslint
tslint:
runs-on: front
needs: setup
steps:
- name: Run tslint
run: cd ${{ needs.checkout.outputs.workspace_path }} && yarn tslint
prettier:
runs-on: front
needs: setup
steps:
- name: Run prettier
run: cd ${{ needs.checkout.outputs.workspace_path }} && 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 ${{ needs.checkout.outputs.workspace_path }}