Skip to content

Webhook Update staging #523

Webhook Update staging

Webhook Update staging #523

Workflow file for this run

name: Webhook Update staging
on:
workflow_run:
workflows: ["Docker Image CI"]
types:
- completed
jobs:
webhook:
runs-on: ubuntu-latest
steps:
- name: Wait for Docker workflow to complete
uses: actions/github-script@v4
with:
script: |
const runs = await github.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'docker.yml',
status: 'completed',
per_page: 1
});
const completedRun = runs.data.workflow_runs[0];
if (!completedRun || completedRun.conclusion !== 'success') {
throw new Error('Docker workflow failed or not completed successfully.');
}
console.log('Docker workflow completed successfully. Proceed with webhook.');
build:
runs-on: ubuntu-latest
steps:
- name: Trigger second repository
run: |
curl -XPOST -u "eolito:${{secrets.WEBHOOK_SECRET}}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/eol-uchile/edx-kustomize/dispatches --data '{"event_type": "update-images", "client_payload": {"type": "staging"}}'