Skip to content

Commit

Permalink
Merge pull request #51 from kosli-dev/auto-approve-3
Browse files Browse the repository at this point in the history
Auto-approve: Do not fail job if not able to merge
  • Loading branch information
jumboduck authored Nov 29, 2023
2 parents ccd7ba2 + 305fc96 commit 562ff7a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,26 @@ jobs:
uses: tj-actions/changed-files@v40

- name: Check non critical
id: non-critical
run: |
ACCEPTED_PATHS="^bin/|^design-docs/"
CRITICAL=false
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file"
# exit as soon as a file does not match the ACCEPTED_PATHS
[[ "$file" =~ ${ACCEPTED_PATHS} ]] || exit 1
# set CRITICAL as true when a file does not match the ACCEPTED_PATHS
[[ "$file" =~ ${ACCEPTED_PATHS} ]] || CRITICAL=true
done
echo "critical=${CRITICAL}" >> "$GITHUB_OUTPUT"
- name: Approve pull request
if: ${{ steps.non-critical.outputs.critical == 'false' }}
uses: hmarr/auto-approve-action@v3
with:
review-message: "Auto approved since only non critical files were changed"


- name: Merge to master
if: ${{ steps.non-critical.outputs.critical == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_LABELS: ""
Expand Down

0 comments on commit 562ff7a

Please sign in to comment.