From 00658f296218b5e87de1a9d6f3f7c491bc231891 Mon Sep 17 00:00:00 2001 From: egibs <20933572+egibs@users.noreply.github.com> Date: Fri, 1 Nov 2024 09:14:01 -0500 Subject: [PATCH] Simplify commit and PR steps Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --- .github/workflows/third-party.yaml | 34 ++++++++++++------------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/third-party.yaml b/.github/workflows/third-party.yaml index 0b8549958..e819163aa 100644 --- a/.github/workflows/third-party.yaml +++ b/.github/workflows/third-party.yaml @@ -4,6 +4,9 @@ on: workflow_dispatch: schedule: - cron: "0 */12 * * *" + push: + branches: + - third-party-no-op-fix permissions: contents: read @@ -42,26 +45,15 @@ jobs: - name: Run make refresh-test-data run: | make refresh-sample-testdata - - name: Retrieve changes - id: check + - name: Commit changes and create PR run: | - echo "CHANGES=$(git status -s | wc -l)" >> $GITHUB_OUTPUT - - name: Add and commit changes - if: ${{ steps.check.outputs.CHANGES }} > 0 - id: commit - run: | - DATE=$(date +%F) - BRANCH="third-party-rule-update-${DATE}" - git checkout -b $BRANCH - git add . - git commit -m "Update third-party rules as of ${DATE}" - git push origin $BRANCH + if [[ -n $(git status -s) ]]; then + DATE=$(date +%F) + BRANCH="third-party-rule-update-${DATE}" + git checkout -b $BRANCH + git add . + git commit -m "Update third-party rules as of ${DATE}" + git push origin $BRANCH - echo "DATE=${DATE}" >> $GITHUB_OUTPUT - - name: Create Pull Request - if: ${{ steps.check.outputs.CHANGES }} > 0 - env: - GH_TOKEN: ${{ steps.octo-sts.outputs.token }} - run: | - DATE=${{ steps.commit.outputs.DATE }} - gh pr create -t "Update third-party rules as of ${DATE}" -b "${DATE} third-party rule update for malcontent." -B main + gh pr create -t "Update third-party rules as of ${DATE}" -b "${DATE} third-party rule update for malcontent." -B main + fi