Merge pull request #1124 from bouthilx/fix-pre-commit #106
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
name: Dashboard Build PR | |
on: | |
push: | |
branches: [ develop ] | |
defaults: | |
run: | |
working-directory: dashboard/src | |
jobs: | |
build_dashboard: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Compile Dashboard | |
run: | | |
# NB: We are in directory dashboard/src | |
yarn | |
yarn build | |
# If previous build folder exists and is same as new one, do not update. | |
# In any other case, we must update. | |
if ( [ -d "../build" ] && diff -qr build ../build ); then UPDATE_BUILD=0; else UPDATE_BUILD=1; fi | |
echo "update_build=${UPDATE_BUILD}" >> $GITHUB_ENV | |
echo Build changes ? ${UPDATE_BUILD} | |
- name: Update compiled Dashboard | |
if: ${{ env.update_build == '1' }} | |
run: | | |
rm -rf ../build | |
mv build .. | |
- name: Create Pull Request | |
if: ${{ env.update_build == '1' }} | |
id: cpr | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
commit-message: 'Compile Dashboard' | |
branch: ci/build-dashboard | |
base: develop | |
delete-branch: true | |
title: 'Compile Dashboard' | |
body: | | |
Auto-generated by [create-pull-request][1] | |
[1]: https://github.com/peter-evans/create-pull-request | |
labels: | | |
automated pr | |
- name: Check outputs | |
if: ${{ env.update_build == '1' }} | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |