Update trigger_rebuild.yaml

This commit is contained in:
2025-01-22 15:45:20 +00:00
committed by GitHub
parent 23b66d5837
commit 998f249adb

View File

@@ -1,34 +1,34 @@
name: Trigger Build name: Trigger Container Rebuild
on: on:
push: push:
branches: branches:
- main # or whichever branches you want to monitor - main
jobs: jobs:
trigger: trigger:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Trigger container rebuild - name: Trigger rebuild
env:
GH_TOKEN: ${{ secrets.PUBLIC_REPO_SYNC_TOKEN }}
run: | run: |
curl -L \ if [ -z "$GH_TOKEN" ]; then
-X GET \ echo "Error: PUBLIC_REPO_SYNC_TOKEN secret is not set"
-H "Accept: application/vnd.github+json" \ exit 1
-H "Authorization: Bearer ${{ secrets.PAT_TOKEN }}" \ fi
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/Cian-H/my_nvim
response=$(curl -L \ response=$(curl -L \
-X POST \ -X POST \
-H "Accept: application/vnd.github+json" \ -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PUBLIC_REPO_SYNC_TOKEN }}" \ -H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \ -H "X-GitHub-Api-Version: 2022-11-28" \
-w "%{http_code}" \ -w "%{http_code}" \
-o /dev/null \ -o /dev/null \
https://api.github.com/repos/Cian-H/my_nvim/dispatches \ https://api.github.com/repos/Cian-H/my_nvim/dispatches \
-d '{"event_type":"rebuild-container","client_payload":{"repository":"${{ github.repository }}"}}') -d '{"event_type":"rebuild-container","client_payload":{"repository":"${{ github.repository }}"}}')
if [ "$response" -ne 200 ]; then if [ "$response" -ne 204 ]; then
echo "Failed to trigger workflow. HTTP status code: $response" echo "Failed to trigger workflow. HTTP status code: $response"
exit 1 exit 1
fi fi