-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.25 KB
/
webhook.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Webhook Update Image
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/argocd-config/dispatches --data '{"event_type": "update-docs", "client_payload": {"type": "docs"}}'