Merge pull request #37 from imxade/patch-4 #6
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: Trigger Website Rebuild on Ideas Update | |
| # Required: WEBSITE_REBUILD_TOKEN secret must have "Actions: Write" permission on AOSSIE-Org/website | |
| on: | |
| workflow_dispatch: # Allow manual triggering of the workflow | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'GSoC-Ideas/**' # Only trigger when files in GSoC-Ideas folder change | |
| jobs: | |
| notify-website: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Trigger website rebuild | |
| run: | | |
| set -e | |
| # Make API call and capture HTTP status code | |
| HTTP_STATUS=$(curl -L -s -o /dev/null -w "%{http_code}" \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.WEBSITE_REBUILD_TOKEN }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/AOSSIE-Org/website/actions/workflows/rebuild-on-ideas-update.yml/dispatches \ | |
| -d '{"ref":"main"}') | |
| # Verify the request was successful (204 is expected for workflow_dispatch) | |
| if [ "$HTTP_STATUS" -eq 204 ]; then | |
| echo "✓ Successfully triggered website rebuild (HTTP $HTTP_STATUS)" | |
| else | |
| echo "✗ Failed to trigger website rebuild (HTTP $HTTP_STATUS)" | |
| exit 1 | |
| fi | |
| - name: Log trigger details | |
| run: | | |
| echo "Website rebuild triggered by GSoC-Ideas update" | |
| echo "Commit: ${{ github.sha }}" | |
| echo "Author: ${{ github.actor }}" | |