forked from liskin/gh-workflow-keepalive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
28 lines (28 loc) · 845 Bytes
/
action.yml
File metadata and controls
28 lines (28 loc) · 845 Bytes
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
name: Workflow Keepalive
description: >-
GitHub Action to prevent GitHub from disabling scheduled workflows due to
repository inactivity
branding:
icon: activity
color: red
inputs:
GITHUB_TOKEN:
required: false
description: >-
GITHUB_TOKEN with actions: write permissions
(default: github.token)
runs:
using: composite
steps:
- name: Re-enable workflow
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN || github.token }}
shell: sh
run: |
case "${GITHUB_WORKFLOW_REF:?}" in
"${GITHUB_REPOSITORY:?}"/.github/workflows/*.y*ml@*) ;;
*) false ;;
esac
workflow="${GITHUB_WORKFLOW_REF%%@*}"
workflow="${workflow#${GITHUB_REPOSITORY}/.github/workflows/}"
gh api -X PUT "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow}/enable"