-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtrigger-developer-site-redeploy.yml
More file actions
67 lines (59 loc) · 2.07 KB
/
trigger-developer-site-redeploy.yml
File metadata and controls
67 lines (59 loc) · 2.07 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Trigger Developer Site Redeploy
on:
workflow_dispatch:
inputs:
reason:
description: 'Reason for triggering developer site redeploy'
required: false
default: 'Manual trigger'
type: string
workflow_run:
workflows: ['Deploy Specs to GitHub Pages']
types:
- completed
branches:
- main
permissions:
contents: read
jobs:
trigger-redeploy:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Log trigger reason
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Manually triggered: ${{ github.event.inputs.reason }}"
else
echo "Automatically triggered after successful Deploy Specs to GitHub Pages workflow"
fi
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: gleanwork
repositories: glean-developer-site
- name: Trigger Developer Site Redeploy
uses: actions/github-script@v7
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const reason = '${{ github.event.inputs.reason }}' || "Triggered by OpenAPI specs deployment";
const result = await github.rest.actions.createWorkflowDispatch({
owner: 'gleanwork',
repo: 'glean-developer-site',
workflow_id: 'trigger-redeploy.yml',
ref: 'main',
inputs: {
reason,
}
});
console.log('Developer site redeploy triggered:', result.status);
- name: Summary
run: |
echo "✅ Developer site redeploy workflow has been triggered successfully!"
echo ""
echo "View the triggered workflow at:"
echo "https://github.com/gleanwork/glean-developer-site/actions"