Skip to content

Commit 0b8c2d4

Browse files
authored
Dont try to autocommit on dependabot or fork jobs (#187)
* Dont use secret in dependabot job * add brackets * trigger change * Automatically applied linter * print env * add brackets * Automatically applied linter * remove debug line --------- Co-authored-by: GitHub Actions Bot <>
1 parent 8e69431 commit 0b8c2d4

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/linter.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ concurrency:
1111
jobs:
1212
linter:
1313
runs-on: ubuntu-latest
14+
env:
15+
LocalCommit: ${{ github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
1416

1517
steps:
1618
- uses: actions/checkout@v4
1719
with:
1820
fetch-depth: 0
1921
ref: ${{ github.head_ref }}
2022
token: ${{ secrets.LINTER_PAT }}
23+
if: env.LocalCommit
2124

22-
- name: Install clang-format
23-
if: inputs.apply_clang_format
24-
run: pip3 install clang-format==14.0.0
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
ref: ${{ github.head_ref }}
29+
if: ${{ !env.LocalCommit }}
2530

2631
- run: git fetch origin $GITHUB_BASE_REF
2732

@@ -59,8 +64,14 @@ jobs:
5964
git config user.email "<>"
6065
6166
- name: Commit changes
62-
if: steps.check-changes.outputs.ChangesFound == 'True'
67+
if: steps.check-changes.outputs.ChangesFound == 'True' && env.LocalCommit
6368
run: |
6469
git commit -am "Automatically applied linter"
6570
git push
6671
72+
- name: Notify that changes are required
73+
if: ${{ steps.check-changes.outputs.ChangesFound == 'True' && !env.LocalCommit }}
74+
run: |
75+
echo "Linter changes are required" >> $GITHUB_STEP_SUMMARY
76+
exit 1
77+

0 commit comments

Comments
 (0)