Skip to content

Commit c3338dc

Browse files
committed
feat(self-update): disable workflow if token is not set
1 parent 95fc7e9 commit c3338dc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/self-update.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: self-update
22

3-
permissions: {}
3+
permissions:
4+
actions: write
45

56
on:
67
workflow_dispatch:
@@ -13,12 +14,14 @@ jobs:
1314
steps:
1415
- name: ensure token
1516
run: |
16-
if [[ -z "$GH_TOKEN" ]]; then
17-
echo "::error::GH_SELF_UPDATE_TOKEN secret is not set. Please either set this secret or disable this workflow."
17+
if [[ -z "$GH_SELF_UPDATE_TOKEN" ]]; then
18+
echo "::error::GH_SELF_UPDATE_TOKEN secret is not set. Disabling this workflow for now. If you want your fork to update itself automatically, please set this secret and re-enable this workflow."
19+
gh -R "$GITHUB_REPOSITORY" workflow disable "$GITHUB_WORKFLOW"
1820
exit 1
1921
fi
2022
env:
21-
GH_TOKEN: ${{ secrets.GH_SELF_UPDATE_TOKEN }}
23+
GH_SELF_UPDATE_TOKEN: ${{ secrets.GH_SELF_UPDATE_TOKEN }}
24+
GH_TOKEN: ${{ github.token }}
2225

2326
- name: get upstream repo
2427
id: upstream

0 commit comments

Comments
 (0)