# yamllint disable rule:line-length # shellcheck disable=SC2043 --- name: PR automerge on: pull_request: types: - labeled - synchronize - opened - edited - ready_for_review - reopened - unlocked pull_request_review: types: - submitted jobs: auto-merge: runs-on: ubuntu-latest steps: - name: Check PR title run: | title="${{ github.event.pull_request.title }}" if [[ "$title" == *"auto_merge"* ]]; then echo "PR title contains auto_merge" echo "AUTO_MERGE=true" >> $GITHUB_ENV else echo "PR title does not contain automerge" echo "AUTO_MERGE=false" >> $GITHUB_ENV fi - name: Check PR status if: env.AUTO_MERGE == 'true' run: | #status="${{ github.event.check_suite.conclusion }}" #if [[ "$status" == "success" ]]; then echo "All checks are successful" echo "PR_STATUS=true" >> $GITHUB_ENV #else # echo "Some checks are not successful" # echo "PR_STATUS=false" >> $GITHUB_ENV #fi - name: Merge PR if: env.PR_STATUS == 'true' run: | curl -X PUT -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge