name: Run speedlify on: push: workflow_dispatch: schedule: - cron: "0 * * * *" jobs: run-tests: runs-on: ubuntu-latest steps: - name: Checkout results id: checkout-results uses: actions/checkout@v2 continue-on-error: true with: ref: refs/heads/results path: results - name: Checkout speedlify uses: actions/checkout@v2 with: path: default - name: Copy existing results if: steps.checkout-results.outcome == 'success' run: cp -r results/. default/_data - name: Install npm dependencies run: npm install working-directory: default - name: Run test-pages run: npm run test-pages working-directory: default - name: Upload results artifact uses: actions/upload-artifact@v2 with: name: results path: default/_data/results - name: Upload results-last-runs artifact uses: actions/upload-artifact@v2 with: name: results-last-runs.json path: default/_data/results-last-runs.json - name: Push results run: | mkdir -p results rm -rf results/* cp -r default/_data/results* results cd results ORIGIN=https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }}.git git init git switch results || git switch -c results if [[ `git status --porcelain` ]]; then git config user.name github-actions git config user.email github-actions@github.com git add . git commit -m "Commit results" git push -u $ORIGIN results fi