Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only checkout necessary directories #908

Merged
merged 25 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
deploy-pr-preview:
uses: grafana/writers-toolkit/.github/workflows/deploy-preview.yml@main
uses: grafana/writers-toolkit/.github/workflows/deploy-preview.yml@robbymilo/deploy-preview
with:
sha: ${{ github.event.pull_request.head.sha }}
branch: ${{ github.head_ref }}
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: github.event.action == 'opened' || github.event.action == 'synchronize'
with:
sparse-checkout-cone-mode: false # exclude root files
sparse-checkout: docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make this configurable in the future if we like but every standard project and every one that I can think of (ignoring plugins) uses this structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, that means I can get rid of trimming the source_directory.


# get the Dockerfile and nginx conf
- name: Sparse checkout
Expand All @@ -78,6 +81,17 @@ jobs:
sparse-checkout: |
deploy-preview

# sparse checkout with cone mode disabled includes root files, even when using exclusions
# see https://github.com/actions/checkout/issues/1430#issuecomment-1756326892
- name: Keep only necessary files
if: github.event.action == 'opened' || github.event.action == 'synchronize'
shell: bash
run: |
shopt -s extglob
rm -rf !(docs|deploy-preview-files|.git)
ls -al
ls -al ${{ inputs.source_directory }}

- name: Build website
if: github.event.action == 'opened' || github.event.action == 'synchronize'
shell: bash
Expand Down
1 change: 1 addition & 0 deletions docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ If it's your first time using the guide, start with the [Get started](https://gr

Writers' Toolkit is open source and available at [`grafana/writers-toolkit`](https://github.com/grafana/writers-toolkit).
If you have questions, or feedback on how to improve this documentation, [open an issue](https://github.com/grafana/writers-toolkit/issues/new) and help make this an even better resource.
.