From f3a07949e65e5a38930d2d1058738fc8a7e3199d Mon Sep 17 00:00:00 2001 From: Philipp Date: Sun, 30 Aug 2020 22:26:18 +0200 Subject: [PATCH] Optimize Github Action Workflow --- .github/workflows/images.yml | 12 ++++++++---- .github/workflows/update-sh.yml | 32 +++++++++++++++++++------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 4813ecc..cc6a842 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -1,10 +1,12 @@ -name: GitHub CI +name: Images on: pull_request: - push: - schedule: - - cron: 0 0 * * 0 + workflow_run: + workflows: ["update.sh"] + branches: [stable] + types: + - completed defaults: run: @@ -36,6 +38,8 @@ jobs: - uses: actions/checkout@v2 - name: Prepare Environment run: ${{ matrix.runs.prepare }} + - name: Run update.sh script + run: ./update.sh - name: Pull Dependencies run: ${{ matrix.runs.pull }} - name: Build ${{ matrix.name }} diff --git a/.github/workflows/update-sh.yml b/.github/workflows/update-sh.yml index 3f5fb09..e1d406c 100644 --- a/.github/workflows/update-sh.yml +++ b/.github/workflows/update-sh.yml @@ -1,22 +1,28 @@ name: update.sh on: - pull_request: - -defaults: - run: - shell: 'bash -Eeuo pipefail -x {0}' + push: + branches: + - stable + schedule: + - cron: '15 0 * * *' jobs: - - check-changes: - name: Check for Changes + run_update_sh: + name: Run update.sh script runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Check for Changes + - name: Run update.sh script + run: ./update.sh + - name: Commit files run: | - hash_before="$(git write-tree)" - ./update.sh - git add -A - [[ "$hash_before" = "$(git write-tree)" ]] + git config --local user.email "workflow@github.com" + git config --local user.name "GitHub Workflow" + git add ./* + git commit -m "Runs update.sh" || echo "Nothing to update" + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + force: true