-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #870 from NordicSemiconductor/ci/reusable-actions
ci: add reusable workflow actions
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
|
||
|
||
|