Adding a key for making a workflow call another workflow.
All checks were successful
CICD Start / Sanity and Base Decision (pull_request) Successful in 1m9s
All checks were successful
CICD Start / Sanity and Base Decision (pull_request) Successful in 1m9s
Signed-off-by: copilotcoder <copilotcoder@darkhelm.org>
This commit is contained in:
@@ -124,13 +124,19 @@ jobs:
|
||||
steps:
|
||||
- name: Dispatch tests workflow
|
||||
env:
|
||||
PACKAGE_ACCESS_TOKEN: ${{ secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
DISPATCH_TOKEN: ${{ secrets.ACTIONS_TRIGGER_TOKEN || secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
HEAD_SHA: ${{ needs.setup.outputs.head_sha }}
|
||||
REPO_FULL: ${{ github.repository }}
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
if [ -z "${DISPATCH_TOKEN}" ]; then
|
||||
echo "❌ Missing dispatch token. Set ACTIONS_TRIGGER_TOKEN (repo write scope) or ensure PACKAGE_ACCESS_TOKEN has Actions workflow-dispatch permissions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_BASE="${GITHUB_SERVER_URL%/}/api/v1"
|
||||
REPO_OWNER="${REPO_FULL%/*}"
|
||||
REPO_NAME="${REPO_FULL#*/}"
|
||||
@@ -147,8 +153,17 @@ jobs:
|
||||
EOF
|
||||
)
|
||||
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: token ${PACKAGE_ACCESS_TOKEN}" \
|
||||
DISPATCH_URL="${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/cicd-tests.yaml/dispatches"
|
||||
HTTP_CODE=$(curl -sS -o /tmp/dispatch-response.txt -w "%{http_code}" -X POST \
|
||||
-H "Authorization: token ${DISPATCH_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/cicd-tests.yaml/dispatches" \
|
||||
-d "${payload}"
|
||||
"${DISPATCH_URL}" \
|
||||
-d "${payload}" || true)
|
||||
|
||||
if [ "${HTTP_CODE}" -lt 200 ] || [ "${HTTP_CODE}" -ge 300 ]; then
|
||||
echo "❌ Dispatch failed with HTTP ${HTTP_CODE}"
|
||||
echo "Dispatch URL: ${DISPATCH_URL}"
|
||||
echo "Response body:"
|
||||
cat /tmp/dispatch-response.txt || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -157,7 +157,7 @@ jobs:
|
||||
- name: Dispatch downstream workflow
|
||||
if: steps.base-decision.outcome == 'success' && steps.base-decision.outputs.head_sha != '' && steps.base-decision.outputs.base_needed != ''
|
||||
env:
|
||||
PACKAGE_ACCESS_TOKEN: ${{ secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
DISPATCH_TOKEN: ${{ secrets.ACTIONS_TRIGGER_TOKEN || secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
BASE_NEEDED: ${{ steps.base-decision.outputs.base_needed }}
|
||||
HEAD_SHA: ${{ steps.base-decision.outputs.head_sha }}
|
||||
REPO_FULL: ${{ github.repository }}
|
||||
@@ -165,6 +165,12 @@ jobs:
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
if [ -z "${DISPATCH_TOKEN}" ]; then
|
||||
echo "❌ Missing dispatch token. Set ACTIONS_TRIGGER_TOKEN (repo write scope) or ensure PACKAGE_ACCESS_TOKEN has Actions workflow-dispatch permissions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_BASE="${GITHUB_SERVER_URL%/}/api/v1"
|
||||
REPO_OWNER="${REPO_FULL%/*}"
|
||||
REPO_NAME="${REPO_FULL#*/}"
|
||||
@@ -188,8 +194,17 @@ jobs:
|
||||
EOF
|
||||
)
|
||||
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: token ${PACKAGE_ACCESS_TOKEN}" \
|
||||
DISPATCH_URL="${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/${TARGET_WORKFLOW}/dispatches"
|
||||
HTTP_CODE=$(curl -sS -o /tmp/dispatch-response.txt -w "%{http_code}" -X POST \
|
||||
-H "Authorization: token ${DISPATCH_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/${TARGET_WORKFLOW}/dispatches" \
|
||||
-d "${payload}"
|
||||
"${DISPATCH_URL}" \
|
||||
-d "${payload}" || true)
|
||||
|
||||
if [ "${HTTP_CODE}" -lt 200 ] || [ "${HTTP_CODE}" -ge 300 ]; then
|
||||
echo "❌ Dispatch failed with HTTP ${HTTP_CODE}"
|
||||
echo "Dispatch URL: ${DISPATCH_URL}"
|
||||
echo "Response body:"
|
||||
cat /tmp/dispatch-response.txt || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -24,13 +24,19 @@ jobs:
|
||||
|
||||
- name: Dispatch CICD Start workflow
|
||||
env:
|
||||
PACKAGE_ACCESS_TOKEN: ${{ secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
DISPATCH_TOKEN: ${{ secrets.ACTIONS_TRIGGER_TOKEN || secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
REPO_FULL: ${{ github.repository }}
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
HEAD_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
if [ -z "${DISPATCH_TOKEN}" ]; then
|
||||
echo "❌ Missing dispatch token. Set ACTIONS_TRIGGER_TOKEN (repo write scope) or ensure PACKAGE_ACCESS_TOKEN has Actions workflow-dispatch permissions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_BASE="${GITHUB_SERVER_URL%/}/api/v1"
|
||||
REPO_OWNER="${REPO_FULL%/*}"
|
||||
REPO_NAME="${REPO_FULL#*/}"
|
||||
@@ -47,8 +53,17 @@ jobs:
|
||||
EOF
|
||||
)
|
||||
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: token ${PACKAGE_ACCESS_TOKEN}" \
|
||||
DISPATCH_URL="${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/cicd-start.yaml/dispatches"
|
||||
HTTP_CODE=$(curl -sS -o /tmp/dispatch-response.txt -w "%{http_code}" -X POST \
|
||||
-H "Authorization: token ${DISPATCH_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/cicd-start.yaml/dispatches" \
|
||||
-d "${payload}"
|
||||
"${DISPATCH_URL}" \
|
||||
-d "${payload}" || true)
|
||||
|
||||
if [ "${HTTP_CODE}" -lt 200 ] || [ "${HTTP_CODE}" -ge 300 ]; then
|
||||
echo "❌ Dispatch failed with HTTP ${HTTP_CODE}"
|
||||
echo "Dispatch URL: ${DISPATCH_URL}"
|
||||
echo "Response body:"
|
||||
cat /tmp/dispatch-response.txt || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -340,13 +340,19 @@ jobs:
|
||||
steps:
|
||||
- name: Dispatch main build workflow
|
||||
env:
|
||||
PACKAGE_ACCESS_TOKEN: ${{ secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
DISPATCH_TOKEN: ${{ secrets.ACTIONS_TRIGGER_TOKEN || secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
HEAD_SHA: ${{ github.event.inputs.head_sha || github.sha }}
|
||||
REPO_FULL: ${{ github.repository }}
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
if [ -z "${DISPATCH_TOKEN}" ]; then
|
||||
echo "❌ Missing dispatch token. Set ACTIONS_TRIGGER_TOKEN (repo write scope) or ensure PACKAGE_ACCESS_TOKEN has Actions workflow-dispatch permissions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_BASE="${GITHUB_SERVER_URL%/}/api/v1"
|
||||
REPO_OWNER="${REPO_FULL%/*}"
|
||||
REPO_NAME="${REPO_FULL#*/}"
|
||||
@@ -364,8 +370,17 @@ jobs:
|
||||
EOF
|
||||
)
|
||||
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: token ${PACKAGE_ACCESS_TOKEN}" \
|
||||
DISPATCH_URL="${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/docker-build-main.yaml/dispatches"
|
||||
HTTP_CODE=$(curl -sS -o /tmp/dispatch-response.txt -w "%{http_code}" -X POST \
|
||||
-H "Authorization: token ${DISPATCH_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/docker-build-main.yaml/dispatches" \
|
||||
-d "${payload}"
|
||||
"${DISPATCH_URL}" \
|
||||
-d "${payload}" || true)
|
||||
|
||||
if [ "${HTTP_CODE}" -lt 200 ] || [ "${HTTP_CODE}" -ge 300 ]; then
|
||||
echo "❌ Dispatch failed with HTTP ${HTTP_CODE}"
|
||||
echo "Dispatch URL: ${DISPATCH_URL}"
|
||||
echo "Response body:"
|
||||
cat /tmp/dispatch-response.txt || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -156,13 +156,19 @@ jobs:
|
||||
steps:
|
||||
- name: Dispatch checks workflow
|
||||
env:
|
||||
PACKAGE_ACCESS_TOKEN: ${{ secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
DISPATCH_TOKEN: ${{ secrets.ACTIONS_TRIGGER_TOKEN || secrets.PACKAGE_ACCESS_TOKEN }}
|
||||
HEAD_SHA: ${{ needs.build.outputs.head_sha }}
|
||||
REPO_FULL: ${{ github.repository }}
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
REF_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
if [ -z "${DISPATCH_TOKEN}" ]; then
|
||||
echo "❌ Missing dispatch token. Set ACTIONS_TRIGGER_TOKEN (repo write scope) or ensure PACKAGE_ACCESS_TOKEN has Actions workflow-dispatch permissions."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
API_BASE="${GITHUB_SERVER_URL%/}/api/v1"
|
||||
REPO_OWNER="${REPO_FULL%/*}"
|
||||
REPO_NAME="${REPO_FULL#*/}"
|
||||
@@ -179,8 +185,17 @@ jobs:
|
||||
EOF
|
||||
)
|
||||
|
||||
curl -fsS -X POST \
|
||||
-H "Authorization: token ${PACKAGE_ACCESS_TOKEN}" \
|
||||
DISPATCH_URL="${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/cicd-checks.yaml/dispatches"
|
||||
HTTP_CODE=$(curl -sS -o /tmp/dispatch-response.txt -w "%{http_code}" -X POST \
|
||||
-H "Authorization: token ${DISPATCH_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/cicd-checks.yaml/dispatches" \
|
||||
-d "${payload}"
|
||||
"${DISPATCH_URL}" \
|
||||
-d "${payload}" || true)
|
||||
|
||||
if [ "${HTTP_CODE}" -lt 200 ] || [ "${HTTP_CODE}" -ge 300 ]; then
|
||||
echo "❌ Dispatch failed with HTTP ${HTTP_CODE}"
|
||||
echo "Dispatch URL: ${DISPATCH_URL}"
|
||||
echo "Response body:"
|
||||
cat /tmp/dispatch-response.txt || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user