Skip to content

Commit f735c6a

Browse files
committed
Make the release workflow run only from stefanhaller's fork
As far as I can tell, this is the only way to make sure that releases show up as created by me. Also, we totally don't want it to run in other people's forks (although it would likely just have failed there, but still). The restriction only applies to scheduled runs; manually triggering the action is still possible from everywhere. There needs to be a personal access token named LAZYGIT_RELEASE_PAT configured on the repo for this to work, though.
1 parent 7ef8385 commit f735c6a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ jobs:
3030
check-and-release:
3131
runs-on: ubuntu-latest
3232
steps:
33+
- name: Check for correct repository
34+
if: ${{ github.event_name != 'workflow_dispatch' && github.repository != 'stefanhaller/lazygit' }}
35+
run: |
36+
echo "Should only run in the stefanhaller/lazygit repository"
37+
exit 1
38+
3339
- name: Check for first Saturday of the month
3440
if: ${{ github.event_name != 'workflow_dispatch' }}
3541
run: |
@@ -41,6 +47,8 @@ jobs:
4147
- name: Checkout Code
4248
uses: actions/checkout@v4
4349
with:
50+
repository: jesseduffield/lazygit
51+
token: ${{ secrets.LAZYGIT_RELEASE_PAT }}
4452
fetch-depth: 0
4553

4654
- name: Get Latest Tag
@@ -89,7 +97,7 @@ jobs:
8997
exit 1
9098
fi
9199
env:
92-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }}
93101

94102
- name: Calculate next version
95103
run: |
@@ -126,7 +134,7 @@ jobs:
126134
git tag ${{ env.new_tag }}
127135
git push origin ${{ env.new_tag }}
128136
env:
129-
GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}
137+
GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }}
130138

131139
- name: Setup Go
132140
uses: actions/setup-go@v5
@@ -140,11 +148,11 @@ jobs:
140148
version: v2
141149
args: release --clean
142150
env:
143-
GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}}
151+
GITHUB_TOKEN: ${{secrets.LAZYGIT_RELEASE_PAT}}
144152

145153
- name: Bump Homebrew formula
146154
uses: dawidd6/action-homebrew-bump-formula@v3
147155
with:
148-
token: ${{secrets.GITHUB_API_TOKEN}}
156+
token: ${{secrets.LAZYGIT_RELEASE_PAT}}
149157
formula: lazygit
150158
tag: ${{env.new_tag}}

0 commit comments

Comments
 (0)