From dac25a14770837685a9283d7485ace935da77b76 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Wed, 27 Sep 2023 12:51:06 +0900 Subject: [PATCH] Skip to push and create PRs for no commits https://github.com/kachick/selfup/actions/runs/6320299424/job/17162614686#step:10:9 --- .github/workflows/update-nixpkgs.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-nixpkgs.yml b/.github/workflows/update-nixpkgs.yml index e81edbe..40f6b5f 100644 --- a/.github/workflows/update-nixpkgs.yml +++ b/.github/workflows/update-nixpkgs.yml @@ -46,10 +46,15 @@ jobs: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" git switch -c "${PR_BRANCH}" - run: nix develop --command task update + - name: Count added commits + id: count-commits + run: | + count="$(git rev-list --count main..)" + echo "count=${count}" | tee -a "$GITHUB_OUTPUT" - run: git push origin "${PR_BRANCH}" - if: github.event_name != 'pull_request' + if: (github.event_name != 'pull_request') && (${{ steps.count-commits.outputs.count }} > 0) - name: Create PR - if: github.event_name != 'pull_request' + if: (github.event_name != 'pull_request') && (${{ steps.count-commits.outputs.count }} > 0) env: GITHUB_TOKEN: ${{ steps.publish-token.outputs.token }} run: |