Skip to content

Conversation

@Mudaafi
Copy link
Contributor

@Mudaafi Mudaafi commented May 3, 2025

PR Description

  1. Adds doctoc as a dependency
  2. Creates a pre_push post_commit script using husky to seamlessly run doctoc if the README.md file has been updated, ensuring that the TOC always remains updated. (This could be a GHA as well)

@Mudaafi Mudaafi changed the base branch from main to docs-revamp May 3, 2025 02:30
.husky/pre-push Outdated
Comment on lines 16 to 17
git add README.md
git commit --amend --no-edit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will automatically amend the commit that is about to be pushed to remote. It's seamless, so as a contributor you might not even realize your final commit has been changed before it was pushed. That said, it lowkey scares me so we could make it a manual process instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update: @esezen suggested maybe adding a new commit instead of amending the existing one, but it turns out that doesn't play well cc: https://stackoverflow.com/questions/21334493/git-commit-in-pre-push-hook

@Mudaafi Mudaafi marked this pull request as ready for review May 5, 2025 16:02
@Mudaafi Mudaafi requested a review from a team as a code owner May 5, 2025 16:02
Copy link
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

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

@Mudaafi let me know if this is a problem on my end but the pre-push hook is pushing the original commit rather than the amended one for me. So instead of doing amend and push, it does push and amend which creates a divergent branch (?) between origin and local 🤔

My local has the updated ToC but the version that gets pushed to GH doesn't

@Mudaafi
Copy link
Contributor Author

Mudaafi commented May 8, 2025

@esezen Hmm it works for me. Let's hop on a sync

@Mudaafi Mudaafi requested review from esezen and mocca102 May 29, 2025 01:55
@Mudaafi
Copy link
Contributor Author

Mudaafi commented May 29, 2025

@enes @mocca102 Following our discussion, since amending the commits in-flight when a git push is run leads to flaky behavior, I've modified the script to be a post_commit hook instead. Logic is similar, but now it adds a new, separate commit if the README.md changes result in a TOC update.

Copy link
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

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

LGTM!

@Mudaafi Mudaafi merged commit 7c4408b into docs-revamp Jun 3, 2025
6 of 8 checks passed
@Mudaafi Mudaafi deleted the ci-4292-os-ui-autocomplete-github-readme-add-automatic-generation branch June 3, 2025 01:11
Alexey-Pavlov added a commit that referenced this pull request Oct 22, 2025
* Ci 4255 os UI autocomplete add GitHub readme overview (#201)

* Add Library overview and installation and quick guide

* update title

* update styles

* update styles

* updates

* updates

* Edit gif height

* remove yarn

* remove yarn

* update

* Update README

Co-authored-by: Ahmad Mudaafi' <ahmad.mudaafi@constructor.io>
Co-authored-by: Viktor Zavala <zavala.viktor@gmail.com>

* Address comments

---------

Co-authored-by: Ahmad Mudaafi' <ahmad.mudaafi@constructor.io>
Co-authored-by: Viktor Zavala <zavala.viktor@gmail.com>

* Add Advanced Features (#208)

* Add Advanced Features

* Add code examples section to readme (#209)

* Add code examples section to readme

* Update README.md

Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>

* Update README.md

Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>

---------

Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>

---------

Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>

* Add docs flag to storybook (#210)

* Add Contributing section (#218)

* [CI-4265] Add License to README.md (#216)

* add license

* lint

* add complementary resources (#217)

* Add API regerence section

* [CI-4261] New Docs: Add Troubleshooting Section to Readme (#220)

* add troubleshooting section

* left align text in tables

* use html instead of markdown to render table

* Update discussions link

* Update integration modes (#213)

* Update integration modes

* upload gif to repo

---------

Co-authored-by: stanlp1 <stanley.peng@constructor.io>

* [CI-4259] Add GitHub readme customization (#214)

* [CI-4259] Add customization section to readme

* [CI-4259] Summarize and shorten descriptions

---------

Co-authored-by: Viktor Zavala <viktor.zavala@constructor.io>

* [CI-4292] Automate Table of Contents Generation using Doctoc (#219)

* add doctoc automation

* Sets pre_push script to be git executable

* Update pre_push hook to exclude changes made by doctoc

* test pre_push hook

* test: edits to doctoc section

* test2: edits to doctoc section

* update pre_push hook

* update readme

* update doctoc configs

* lint

* update pre-push hook to append a new commit instead of ammend

* testing pre_push hook flow

* revert back to amend

* Test the hook

* Test

* testing

* Test Removing section

* a

* b

* c

* Add thing

* Add new topic

* Revert "revert back to amend"

This reverts commit e56366d.

* Reapply "revert back to amend"

This reverts commit 46be0f7.

* Update readme

* Change pre-push to pre-commit

* base case

* move to post-commit

* fix post-commit script

* Test: README Change outside TOC

* docs: auto-update README TOC (post-commit)

* fix post-commit script

* test: local TOC change

* test: addition outside TOC

* docs: auto-update README TOC (post-commit)

* test: removal outside TOC, TOC updated

* run doctoc

---------

Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>
Co-authored-by: mocca102 <islaam.agamy@gmail.com>

* [CI-4320] Create a Props.mdx for CioAutocomplete (#225)

* copy commits

* match comments

* display props page

* update test

* [NOCI] README Troubleshooting: How to Add Peer Dependencies  (#222)

* add peer dependencies to troubleshooting.md

* lint

* transform mardown links to html anchors

* code block

* [CDX-257] Update story title for CioAutocomplete component

---------

Co-authored-by: Islam Moustafa <58053149+mocca102@users.noreply.github.com>
Co-authored-by: Ahmad Mudaafi' <ahmad.mudaafi@constructor.io>
Co-authored-by: Viktor Zavala <zavala.viktor@gmail.com>
Co-authored-by: mocca102 <islaam.agamy@gmail.com>
Co-authored-by: Enes Kutay SEZEN <eneskutaysezen@gmail.com>
Co-authored-by: ST P <57369888+stanlp1@users.noreply.github.com>
Co-authored-by: stanlp1 <stanley.peng@constructor.io>
Co-authored-by: Viktor Zavala <viktor.zavala@constructor.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants