Skip to content

testing out the auto-merge shiz #2

testing out the auto-merge shiz

testing out the auto-merge shiz #2

Workflow file for this run

name: Allow Changes in User-Specific shaders/ Directory to Main
on:
pull_request:
branches:
- main
paths:
- 'shaders/*/**'
types: [opened, synchronize, reopened]
jobs:
auto-approve-and-merge:
if: github.base_ref == 'main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check for changes in user-specific directory
id: check_changes
env:
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
git fetch origin ${{ github.base_ref }}
git diff --name-status origin/main ${{ github.sha }} | grep -E '^\w\s+shaders/'"${PR_AUTHOR}"'/.*' > pr_changes.txt
if [ -s pr_changes.txt ]; then
echo "Changes detected in the user-specific directory, proceeding with auto-approve and merge."
echo "valid_user_directory=true" >> $GITHUB_ENV
else
echo "No changes in the user-specific directory, not proceeding."
echo "valid_user_directory=false" >> $GITHUB_ENV
fi
- name: Auto approve
uses: hmarr/auto-approve-action@v2
if: env.valid_user_directory == 'true'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Merge PR
uses: pascalgn/[email protected]
if: env.valid_user_directory == 'true'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
MERGE_METHOD: 'squash'
MERGE_COMMIT_MESSAGE: 'auto-merge: merge PR #{pullRequest.number}'
MERGE_LABELS: 'auto-merge,!work in progress'