ci: Run required status checks for docs-only PRs, but exit early (#22254)
I noticed a problem with the addition of required status checks where PRs that only touched the docs wouldn't pass the status checks due to all of the checks being skipped via `paths-ignore`: <img width="950" alt="Screenshot 2024-12-19 at 11 16 38 AM" src="https://github.com/user-attachments/assets/a6fa43ee-de63-40a6-a15a-f2f3519e9db8" /> This PR aims to address this by making it so required status checks run for docs-only PRs, but exit early (before doing all of the work). Release Notes: - N/A
This commit is contained in:
parent
536a958c58
commit
3d3d8f20eb
1 changed files with 45 additions and 5 deletions
50
.github/workflows/ci.yml
vendored
50
.github/workflows/ci.yml
vendored
|
@ -7,14 +7,9 @@ on:
|
||||||
- "v[0-9]+.[0-9]+.x"
|
- "v[0-9]+.[0-9]+.x"
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
paths-ignore:
|
|
||||||
- "docs/**"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "**"
|
- "**"
|
||||||
paths-ignore:
|
|
||||||
- "docs/**/*"
|
|
||||||
- ".github/workflows/community_*"
|
|
||||||
merge_group:
|
merge_group:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
@ -29,6 +24,23 @@ env:
|
||||||
RUSTFLAGS: "-D warnings"
|
RUSTFLAGS: "-D warnings"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check_docs_only:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
docs_only: ${{ steps.check_changes.outputs.docs_only }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Check for non-docs changes
|
||||||
|
id: check_changes
|
||||||
|
run: |
|
||||||
|
if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -qvE '^docs/'; then
|
||||||
|
echo "docs_only=false" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "docs_only=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
migration_checks:
|
migration_checks:
|
||||||
name: Check Postgres and Protobuf migrations, mergability
|
name: Check Postgres and Protobuf migrations, mergability
|
||||||
if: github.repository_owner == 'zed-industries'
|
if: github.repository_owner == 'zed-industries'
|
||||||
|
@ -97,12 +109,19 @@ jobs:
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
|
needs: check_docs_only
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
|
|
||||||
|
- name: Skip for docs-only changes
|
||||||
|
if: needs.check_docs_only.outputs.docs_only == 'true'
|
||||||
|
run: |
|
||||||
|
echo "Skipping for docs-only changes"
|
||||||
|
exit 0
|
||||||
|
|
||||||
- name: cargo clippy
|
- name: cargo clippy
|
||||||
run: ./script/clippy
|
run: ./script/clippy
|
||||||
|
|
||||||
|
@ -140,6 +159,7 @@ jobs:
|
||||||
if: github.repository_owner == 'zed-industries'
|
if: github.repository_owner == 'zed-industries'
|
||||||
runs-on:
|
runs-on:
|
||||||
- buildjet-16vcpu-ubuntu-2204
|
- buildjet-16vcpu-ubuntu-2204
|
||||||
|
needs: check_docs_only
|
||||||
steps:
|
steps:
|
||||||
- name: Add Rust to the PATH
|
- name: Add Rust to the PATH
|
||||||
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
@ -149,6 +169,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
|
|
||||||
|
- name: Skip for docs-only changes
|
||||||
|
if: needs.check_docs_only.outputs.docs_only == 'true'
|
||||||
|
run: |
|
||||||
|
echo "Skipping for docs-only changes"
|
||||||
|
exit 0
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
|
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
|
||||||
with:
|
with:
|
||||||
|
@ -175,6 +201,7 @@ jobs:
|
||||||
if: github.repository_owner == 'zed-industries'
|
if: github.repository_owner == 'zed-industries'
|
||||||
runs-on:
|
runs-on:
|
||||||
- buildjet-16vcpu-ubuntu-2204
|
- buildjet-16vcpu-ubuntu-2204
|
||||||
|
needs: check_docs_only
|
||||||
steps:
|
steps:
|
||||||
- name: Add Rust to the PATH
|
- name: Add Rust to the PATH
|
||||||
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
@ -184,6 +211,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
|
|
||||||
|
- name: Skip for docs-only changes
|
||||||
|
if: needs.check_docs_only.outputs.docs_only == 'true'
|
||||||
|
run: |
|
||||||
|
echo "Skipping for docs-only changes"
|
||||||
|
exit 0
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
|
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
|
||||||
with:
|
with:
|
||||||
|
@ -202,6 +235,7 @@ jobs:
|
||||||
name: (Windows) Run Clippy and tests
|
name: (Windows) Run Clippy and tests
|
||||||
if: github.repository_owner == 'zed-industries'
|
if: github.repository_owner == 'zed-industries'
|
||||||
runs-on: hosted-windows-1
|
runs-on: hosted-windows-1
|
||||||
|
needs: check_docs_only
|
||||||
steps:
|
steps:
|
||||||
# more info here:- https://github.com/rust-lang/cargo/issues/13020
|
# more info here:- https://github.com/rust-lang/cargo/issues/13020
|
||||||
- name: Enable longer pathnames for git
|
- name: Enable longer pathnames for git
|
||||||
|
@ -211,6 +245,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
|
|
||||||
|
- name: Skip for docs-only changes
|
||||||
|
if: needs.check_docs_only.outputs.docs_only == 'true'
|
||||||
|
run: |
|
||||||
|
echo "Skipping for docs-only changes"
|
||||||
|
exit 0
|
||||||
|
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
|
uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue