Skip to content

Commit

Permalink
Create main.yml (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
17359898647 authored Feb 21, 2024
1 parent 8f8b206 commit 9666889
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
pull_request:
types: [closed]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

check-label:
runs-on: ubuntu-latest
needs: build

steps:
- name: Check for QA PASS label
uses: actions/github-script@v5
with:
script: |
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
if (!pullRequest.labels.map(label => label.name).includes('QA PASS')) {
throw new Error('Pull request does not have a QA PASS label');
}
delete-branch:
runs-on: ubuntu-latest
needs: check-label

steps:
- name: Delete merged branch
uses: pullreminders/delete-merged-branch@master
if: github.event.pull_request.merged == true
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9666889

Please sign in to comment.