Skip to content

Commit 05664bc

Browse files
authored
Merge pull request #5562 from NomicFoundation/galargh/github-actions-lint
ci(v2): remove duplicated lint jobs/steps
2 parents 8c779d8 + a452682 commit 05664bc

File tree

3 files changed

+41
-55
lines changed

3 files changed

+41
-55
lines changed

.github/workflows/check-docs-site.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
jobs:
23-
lint:
24-
name: Lint
23+
build:
24+
name: Build Docs
2525
runs-on: ubuntu-latest
2626
steps:
2727
- uses: actions/checkout@v4
2828
- uses: ./.github/actions/setup-env
2929
- name: Install
3030
run: pnpm install --frozen-lockfile --prefer-offline
3131
- name: Install Docs
32-
run: cd docs && pnpm install --frozen-lockfile --prefer-offline
33-
- name: lint
34-
run: cd docs && pnpm lint
35-
- name: Build
36-
run: cd docs && pnpm build
32+
working-directory: docs/
33+
run: pnpm install --frozen-lockfile --prefer-offline
34+
- name: Build Docs
35+
working-directory: docs/
36+
run: pnpm build

.github/workflows/comment-on-linter-error.yml

-48
This file was deleted.

.github/workflows/lint.yml

+34
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,24 @@ jobs:
2323
lint:
2424
name: Lint
2525
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
2628
steps:
29+
# NOTE: When running on a pull_request_target, we're checking out the repo
30+
# twice. The first checkout is for the base branch of the PR. The second,
31+
# for the merge commit. We do this to be able to use the `setup-env`
32+
# action that's on the base branch.
2733
- uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
- uses: actions/checkout@v4
37+
if: github.event_name == 'pull_request_target'
38+
with:
39+
ref: "refs/pull/${{ github.event.number }}/merge"
40+
persist-credentials: false
41+
- if: github.event_name == 'pull_request_target'
42+
name: Check out setup-env action from the base branch
43+
run: git checkout --no-overlay $GITHUB_SHA -- .github/actions/setup-env
2844
- uses: ./.github/actions/setup-env
2945
- name: Install
3046
run: pnpm install --frozen-lockfile --prefer-offline
@@ -40,3 +56,21 @@ jobs:
4056
- name: Lint website
4157
working-directory: docs/
4258
run: pnpm lint
59+
comment:
60+
needs: [lint]
61+
if: failure() && github.event_name == 'pull_request_target' && needs.lint.result == 'failure'
62+
name: Comment
63+
runs-on: ubuntu-latest
64+
permissions:
65+
pull-requests: write
66+
steps:
67+
- uses: actions/github-script@v7
68+
name: Comment on failure
69+
with:
70+
script: |
71+
github.rest.issues.createComment({
72+
issue_number: context.issue.number,
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
body: "Thanks for submitting this PR!\n\nUnfortunately, it has some linter errors, so we can't merge it yet. Can you please fix them?\n\nRunning pnpm lint:fix in the root of the repository may fix them automatically."
76+
})

0 commit comments

Comments
 (0)