mirror of
https://github.com/Cian-H/my_nvim_config.git
synced 2025-12-22 20:21:57 +00:00
Update trigger_rebuild.yaml
This commit is contained in:
31
.github/workflows/trigger_rebuild.yaml
vendored
31
.github/workflows/trigger_rebuild.yaml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
trigger:
|
trigger:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger rebuild
|
- name: Test repository access
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.PUBLIC_ACTION_TRIGGER_TOKEN }}
|
GH_TOKEN: ${{ secrets.PUBLIC_ACTION_TRIGGER_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
@@ -18,19 +18,34 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
response=$(curl -L \
|
# First test if we can access the repository
|
||||||
|
echo "Testing repository access..."
|
||||||
|
repo_response=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer $GH_TOKEN" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||||
|
https://api.github.com/repos/Cian-H/my_nvim)
|
||||||
|
|
||||||
|
echo "Repository access status code: $repo_response"
|
||||||
|
|
||||||
|
# If we can access the repo, try to create the dispatch
|
||||||
|
if [ "$repo_response" -eq 200 ]; then
|
||||||
|
echo "Repository is accessible, attempting dispatch..."
|
||||||
|
dispatch_response=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Accept: application/vnd.github+json" \
|
-H "Accept: application/vnd.github+json" \
|
||||||
-H "Authorization: Bearer $GH_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}" \
|
|
||||||
-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 204 ]; then
|
echo "Dispatch status code: $dispatch_response"
|
||||||
echo "Failed to trigger workflow. HTTP status code: $response"
|
|
||||||
|
if [ "$dispatch_response" -ne 204 ]; then
|
||||||
|
echo "Failed to create dispatch event"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Cannot access repository"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Successfully triggered workflow"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user