Skip to content

Conversation

mnocon
Copy link
Contributor

@mnocon mnocon commented Nov 29, 2024

Target: master, 4.6, 3.3 and user doc as a follow-up.

Adding a job to automatically generate preview links for all the changed Markdown files, so that we don't have to do this manually. See the comment below.

Option 1: No Markdown changes in the docs directory

Comment saying "No Markdown changes to preview" (#2561 (comment))

Option 2: Markdown changes

Zrzut ekranu 2025-02-7 o 09 22 17

Bot adds a comment with links to all modified previews (without the diff coloring)

Option 3: Too many changes

I've chosen an arbitrary limit of 100 files - we can adjust it if needed. Bot adds a comment that too many files were modified to generate a list of links.

@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@mnocon mnocon force-pushed the preview-links-comment branch from f45d0fd to c47f2fe Compare November 30, 2024 10:13
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@mnocon mnocon force-pushed the preview-links-comment branch from c47f2fe to 3cf1b26 Compare November 30, 2024 10:14
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@ibexa ibexa deleted a comment from github-actions bot Nov 30, 2024
@mnocon mnocon marked this pull request as ready for review December 2, 2024 11:03
@mnocon mnocon requested a review from adriendupuis December 2, 2024 11:04
Comment on lines 33 to 34
Copy link
Contributor

@adriendupuis adriendupuis Dec 4, 2024

Choose a reason for hiding this comment

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

I manage to generate the whole link list in one go:
git diff --name-only HEAD "origin/master" | grep -E "^docs\/.*\.md$" | sed -E "s|^docs/(.*)\.md$|- [docs/\1.md](${build_url}\1/)|"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, this is like magic 😄

I've reworked it a bit to avoid harcoding master and added a new line as it didn't work in Github Actions (it didn't create a list):

                      comment=$(git diff --name-only HEAD "origin/$GITHUB_BASE_REF" | grep -E "^docs\/.*\.md$" | sed -E "s|^docs/(.*)\.md$|- [docs/\1.md](${build_url}\1/)\n|")

@mnocon mnocon force-pushed the preview-links-comment branch from 2c4364a to c271bac Compare February 5, 2025 10:03
@ibexa ibexa deleted a comment from github-actions bot Feb 5, 2025
@ibexa ibexa deleted a comment from github-actions bot Feb 5, 2025
@mnocon mnocon requested a review from adriendupuis February 5, 2025 13:18
@mnocon
Copy link
Contributor Author

mnocon commented Feb 5, 2025

Thank you @adriendupuis for the suggestions, it looks much better now!

@ibexa ibexa deleted a comment from github-actions bot Feb 6, 2025
Copy link

github-actions bot commented Feb 6, 2025

Preview of modified Markdown: no Markdown change to preview.

@mnocon mnocon requested a review from adriendupuis February 6, 2025 13:41
@mnocon mnocon merged commit eb96ce9 into master Feb 11, 2025
6 of 7 checks passed
@mnocon mnocon deleted the preview-links-comment branch February 11, 2025 08:22
mnocon added a commit that referenced this pull request Feb 11, 2025
* Applied review suggestion

* [TMP] Add change

* [TMP] Random change 2

* Fixed hardcoded master

* Fix?

* Fix?

* Removed newline

* Refactoring

* Revert "[TMP] Add change"

This reverts commit d9f9ffd.

* Revert "[TMP] Random change 2"

This reverts commit baa535d.

* Removed file filter from the job

* Refined message

* Applied review wording suggestion

Co-authored-by: Adrien Dupuis <[email protected]>

---------

Co-authored-by: Adrien Dupuis <[email protected]>
mnocon added a commit that referenced this pull request Feb 11, 2025
* Applied review suggestion

* [TMP] Add change

* [TMP] Random change 2

* Fixed hardcoded master

* Fix?

* Fix?

* Removed newline

* Refactoring

* Revert "[TMP] Add change"

This reverts commit d9f9ffd.

* Revert "[TMP] Random change 2"

This reverts commit baa535d.

* Removed file filter from the job

* Refined message

* Applied review wording suggestion

Co-authored-by: Adrien Dupuis <[email protected]>

---------

Co-authored-by: Adrien Dupuis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants