From 8eeebeef2990f6730c4d7a69ab8c4aab75a73351 Mon Sep 17 00:00:00 2001 From: Tam Mach Date: Wed, 14 Oct 2020 15:21:23 +1100 Subject: [PATCH] ci(dep): Add step to commit changes if PR has dependencies label This commit is to perform below steps: - If PR is having dependencies label, update files in dist as well - If PR doesn't have dependencies label, fail the build if there is dirty changes. Closes #55 Signed-off-by: Tam Mach --- .github/workflows/test.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 56f1ece914..f81a97e88e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,29 @@ jobs: - run: | npm install npm run all + + # Update dist files if there is label dependencies + - name: Update dist files + if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'dependencies') + run: | + if [[ -z $(git status -s) ]] + then + echo "No change is required" + else + echo "Updating dist directory" + git config --local user.name "dependabot[bot]" + git config --local user.email "49699333+dependabot[bot]@users.noreply.github.com" + git add --update + git commit --message="Update dist files" + git push + fi + + # Fail the build if there is dirty change + - run: | + git diff --exit-code + test: # make sure the action works on a clean machine without building + needs: [ build ] strategy: matrix: os: