New rules to make small changes easier #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bypass CSS File Reviews by Admin | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
bypass-css-review: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up GitHub CLI Authentication | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
AUTHOR=$(gh pr view ${{ github.event.pull_request.number }} --json author --jq '.author.login') | |
ADMIN_CHECK=$(gh api orgs/${{ github.repository_owner }}/members/$AUTHOR --jq '.role') | |
if [ "$ADMIN_CHECK" != "admin" ]; then | |
echo "User is not an admin. Exiting." | |
exit 1 | |
fi | |
- name: Check for CSS files | |
run: | | |
if git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }} | grep -q '\.css$'; then | |
echo "CSS files detected and user is an admin, bypassing review requirement" | |
gh pr merge ${{ github.event.pull_request.number }} --auto --squash | |
else | |
echo "No CSS files detected or user is not an admin, continuing with normal review process" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |