Skip to content

Commit

Permalink
ci: add reusable workflow actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Pickel authored and Pascal Pickel committed Jan 25, 2024
1 parent 1d8f67e commit 0a47b33
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

name: Build App

on:
workflow_call

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'

- name: Install Dependencies
run: npm ci
- name: Run all checks
run: npm run check
- name: Run Tests
run: npm test
- name: Build for Production
run: npm run build:prod
35 changes: 35 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check labels

on:
workflow_call:

env:
GH_TOKEN: ${{ github.token }}

jobs:
check_labels:
runs-on: ubuntu-latest
steps:
- name: 'Check for required labels'
if: >
contains(github.event.pull_request.labels.*.name, 'doc required') == false &&
contains(github.event.pull_request.labels.*.name, 'doc not required') == false
run: echo "missing_label=true" >> "$GITHUB_ENV"

- name: 'Notify user if label is missing'
if: env.missing_label == 'true'
run: |
URL="${{ github.event.pull_request.html_url }}"
COMMENT_TEXT="Required 'doc required' or 'doc not required label"
if [[ ! $(gh pr view $URL --json comments --jq '.comments[].body | select(. | contains("'"$COMMENT_TEXT"'"))') ]]; then
gh pr comment $URL --body "$COMMENT_TEXT"
fi
- name: 'Fail'
uses: actions/github-script@v7
if: env.missing_label == 'true'
with:
script: core.setFailed('Required "doc required" or "doc not required" label')



0 comments on commit 0a47b33

Please sign in to comment.