Fix. AdminActions. Checking permissions for Actions #60
This file contains hidden or 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: Check for library changes on PR Merge | |
| on: | |
| pull_request: | |
| types: [synchronize, opened, reopened, ready_for_review] | |
| branches: | |
| - dev | |
| - master | |
| env: # environment variables (available in any part of the action) | |
| PHP_VERSION: 7.4 | |
| jobs: | |
| notify: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ env.PHP_VERSION }} | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Dependencies | |
| run: composer i | |
| - name: Check for library changes | |
| id: check-libraries | |
| run: | | |
| CHANGED_FILES=$(git status --porcelain | grep -v '^??' | awk '{print $2}' | grep -v '^composer\.lock$' || true) | |
| if [ -z "$CHANGED_FILES" ]; then | |
| echo "No library changes detected in vendor/" | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| echo "status=success" >> $GITHUB_OUTPUT | |
| else | |
| echo "❌ Library changes detected in vendor/:" | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| echo "status=failure" >> $GITHUB_OUTPUT | |
| HTML_LIST=$(echo "$CHANGED_FILES" | sed 's/^/<li>/;s/$/<\/li>/') | |
| echo "html_list<<EOF" >> $GITHUB_OUTPUT | |
| echo "<ul>$HTML_LIST</ul>" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| exit 1 | |
| fi | |
| - name: Send notification to Matrix | |
| if: failure() && steps.check-libraries.outputs.has_changes == 'true' | |
| uses: Glomberg/matrix-messenger-action@master | |
| with: | |
| server: ${{ secrets.MATRIX_SERVER }} | |
| to: ${{ secrets.MATRIX_EXTERNSION_ROOM }} | |
| token: ${{ secrets.MATRIX_USER_TOKEN }} | |
| message: | | |
| 📦 <strong>Library Changes Detected After PR Merge!</strong> | |
| Repository: <strong>${{ github.repository }}</strong> | |
| PR #${{ github.event.pull_request.number }} merged by: <strong>${{ github.event.pull_request.merged_by.login }}</strong> | |
| <br>Title: ${{ github.event.pull_request.title }} | |
| <br>⚠️ Libraries may not be up-to-date. | |
| <br><strong>Changed files in vendor/:</strong> | |
| ${{ steps.check-libraries.outputs.html_list }} | |
| <a href="${{ github.event.pull_request.html_url }}">View Pull Request</a> |