Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add reusable workflow actions #870

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')