Skip to content

Commit 105a5b2

Browse files
authored
Merge pull request #350 from karlhorky/patch-1
Remove `GITHUB_TOKEN` from readme examples
2 parents f4c4f1d + 7165cff commit 105a5b2

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ jobs:
5555

5656
- name: Compress PR Images
5757
uses: calibreapp/image-actions@main
58-
with:
59-
# `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories.
60-
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6258
```
6359
6460
2. Open a Pull Request with new or updated imagery. Image Actions will optimise images, and commit them to your branch:
@@ -153,7 +149,6 @@ jobs:
153149
id: calibre
154150
uses: calibreapp/image-actions@main
155151
with:
156-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
157152
compressOnly: true
158153
- name: Create New Pull Request If Needed
159154
if: steps.calibre.outputs.markdown != ''
@@ -171,6 +166,15 @@ By default, GitHub Actions do not have permission to alter forked repositories.
171166

172167
1. **Replace the default `GITHUB_TOKEN` with a [Personal Access Token (PAT)](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#permissions-for-the-github_token) which does have permission to access forked repositories.** Be aware that this introduces potential security concerns (which is why it not available by default).
173168

169+
```yml
170+
- name: Compress PR Images
171+
uses: calibreapp/image-actions@main
172+
with:
173+
# `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories.
174+
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
175+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176+
```
177+
174178
2. **Run Image Actions only for Pull Requests in the current repository.** This approach is advised when not using Personal Access Tokens (PATs) to avoid wasting time and compute for compressions that will not be committed. Use the following configuration to check if a Pull Request belongs to the repository:
175179
176180
```yml
@@ -202,7 +206,6 @@ jobs:
202206
id: calibre
203207
uses: calibreapp/image-actions@main
204208
with:
205-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
206209
compressOnly: true
207210
- name: Create New Pull Request If Needed
208211
if: steps.calibre.outputs.markdown != ''
@@ -265,7 +268,6 @@ jobs:
265268
id: calibre
266269
uses: calibreapp/image-actions@main
267270
with:
268-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
269271
# For non-Pull Requests, run in compressOnly mode and we'll PR after.
270272
compressOnly: ${{ github.event_name != 'pull_request' }}
271273
- name: Create Pull Request
@@ -304,3 +306,4 @@ Happy to hear you’re interested in contributing to Image Actions! Please find
304306
This project is licensed under a [GNU General Public License](LICENSE).
305307
306308
309+

0 commit comments

Comments
 (0)