From 282984be5f1c069e68f73b3091007c9c5d7ce51f Mon Sep 17 00:00:00 2001 From: Evan Gibler <20933572+egibs@users.noreply.github.com> Date: Fri, 1 Nov 2024 09:46:57 -0500 Subject: [PATCH] Simplify commit and PR steps for third-party Workflow (#561) Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --- .github/workflows/third-party.yaml | 31 ++++++++++-------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/.github/workflows/third-party.yaml b/.github/workflows/third-party.yaml index 0b8549958..d74c0d037 100644 --- a/.github/workflows/third-party.yaml +++ b/.github/workflows/third-party.yaml @@ -42,26 +42,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