Fix permission issue for slim-lint CI on forks
Forked repos may not have any write permissions, and thus may not write status checks for PRs. Therefore, we disable uploading slim-lint results to GitHub checks for forks. The pass/fail information is still displayed.
This commit is contained in:

committed by
Dominic Sauer

parent
029efd7904
commit
ef732ec031
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@ -111,9 +111,9 @@ jobs:
|
|||||||
|
|
||||||
slim-lint:
|
slim-lint:
|
||||||
permissions:
|
permissions:
|
||||||
# Required: allow read access to the content for analysis.
|
# Required: Allow read access to the content for analysis.
|
||||||
contents: read
|
contents: read
|
||||||
# Allow write access to checks to allow the action to annotate code in the PR.
|
# Required: Allow write access to checks to allow the action to annotate code in the PR.
|
||||||
checks: write
|
checks: write
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -133,7 +133,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload slim-lint results as GitHub annotations
|
- name: Upload slim-lint results as GitHub annotations
|
||||||
uses: lcollins/checkstyle-github-action@v2.0.0
|
uses: lcollins/checkstyle-github-action@v2.0.0
|
||||||
if: ${{ success() || failure() }}
|
# Only create GitHub annotations for the main repo (disable for forks):
|
||||||
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||||
with:
|
with:
|
||||||
name: Slim-Lint Report
|
name: Slim-Lint Report
|
||||||
title: Analyze Slim templates for linting issues
|
title: Analyze Slim templates for linting issues
|
||||||
|
Reference in New Issue
Block a user