-
Notifications
You must be signed in to change notification settings - Fork 13
45 lines (41 loc) · 1.35 KB
/
keepalive.yml
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
name: Keep scheduled workflows alive
on:
workflow_dispatch:
schedule:
- cron: 0 0 1 * *
jobs:
keepalive:
runs-on: ubuntu-22.04
steps:
- name: Disable workflows
uses: actions/github-script@v7
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
script: |
const workflows = await github.rest.actions.listRepoWorkflows({
owner: context.repo.owner,
repo: context.repo.repo,
});
for (const workflow of workflows.data.workflows) {
await github.rest.actions.disableWorkflow({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflow.id,
});
}
- name: Enable workflows
uses: actions/github-script@v7
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
script: |
const workflows = await github.rest.actions.listRepoWorkflows({
owner: context.repo.owner,
repo: context.repo.repo,
});
for (const workflow of workflows.data.workflows) {
await github.rest.actions.enableWorkflow({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflow.id,
});
}