Skip to content

Commit

Permalink
Simplify commit and PR steps for third-party Workflow (#561)
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <[email protected]>
  • Loading branch information
egibs authored Nov 1, 2024
1 parent 917d083 commit 282984b
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions .github/workflows/third-party.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 282984b

Please sign in to comment.