Skip to content

Commit 06b0d32

Browse files
updating linting
1 parent 4575a60 commit 06b0d32

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

.github/workflows/lint.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ permissions:
2626
statuses: write
2727

2828
concurrency:
29-
group: lint-${{ github.event.pull_request.number }}
29+
group: lint-${{ github.event.pull_request.number || github.run_id }}
3030
cancel-in-progress: true
3131

3232
jobs:
@@ -38,8 +38,8 @@ jobs:
3838
with:
3939
clean: 'false'
4040
fetch-depth: '0'
41-
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
42-
repository: ${{ github.event.pull_request.head.repo.full_name }}
41+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
42+
repository: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name || github.repository }}
4343
token: ${{ secrets.RSG_BOT_TOKEN }}
4444
- name: Get Head Commit Message
4545
id: commit-message
@@ -51,17 +51,25 @@ jobs:
5151
install: true
5252
cache: true
5353
- name: 🧹 Lint (hk fix)
54+
if: github.event_name == 'pull_request_target'
5455
run: |
5556
hk fix --from-ref "$DEFAULT_BRANCH" --to-ref "$HEAD"
5657
env:
57-
DEFAULT_BRANCH: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
58-
HEAD: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
58+
DEFAULT_BRANCH: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
59+
HEAD: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
60+
- name: 🧹 Lint (hk check)
61+
if: github.event_name == 'merge_group'
62+
run: |
63+
hk check --from-ref "$DEFAULT_BRANCH" --to-ref "$HEAD"
64+
env:
65+
DEFAULT_BRANCH: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
66+
HEAD: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
5967
- name: Add & Commit
6068
env:
6169
GITHUB_TOKEN: ${{ secrets.RSG_BOT_TOKEN }}
62-
if: ${{ !contains(steps.commit-message.outputs.message, 'Automatically linting code') }}
70+
if: github.event_name == 'pull_request_target' && !contains(steps.commit-message.outputs.message, 'Automatically linting code')
6371
uses: planetscale/ghcommit-action@v0.2.20
6472
with:
6573
commit_message: Automatically linting code
6674
repo: ${{ github.repository }}
67-
branch: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
75+
branch: ${{ github.event.pull_request.head.ref }}

0 commit comments

Comments
 (0)