Skip to content

chore: [CLI-936] Prepare documentation synchronization scripts for new Gitbook structure#5955

Merged
dotkas merged 9 commits into
mainfrom
dotkas/CLI-936/update-synchronization-scripts
Jun 17, 2025
Merged

chore: [CLI-936] Prepare documentation synchronization scripts for new Gitbook structure#5955
dotkas merged 9 commits into
mainfrom
dotkas/CLI-936/update-synchronization-scripts

Conversation

@dotkas
Copy link
Copy Markdown
Contributor

@dotkas dotkas commented Jun 12, 2025

Pull Request Submission Checklist

  • Follows CONTRIBUTING guidelines
  • Commit messages
    are release-note ready, emphasizing
    what was changed, not how.
  • Includes detailed description of changes
  • Contains risk assessment (Low | Medium | High)
  • Highlights breaking API changes (if applicable)
  • Links to automated tests covering new functionality
  • Includes manual testing instructions (if necessary)
  • Updates relevant GitBook documentation (PR link: ___)
  • Includes product update to be announced in the next stable release notes

What does this PR do?

Updates the Gitbook synchronization scripts to prepare for the new file structure being created over on the user-docs repo.

Notable changes:

  • Refactored the Github actions from one giant bash script into modular Github Action steps
  • Renamed a bunch of things to sound more intuitive
  • Added a bit more readability to the bash script parts that I couldn't avoid (early returns etc)
  • Streamlined the two scripts to keep the same conventions across the board. The scripts where previously not really aligned.

Where should the reviewer start?

Workflows.

How should this be manually tested?

Go to Github Actions, click one of them, do a workflow dispatch targeting this branch.

The README updater had its filename changed and thus cannot be run manually in the Actions tab. But I cheated and tested out the code before changing the filename, and the result was good: action, PR.

What's the product update that needs to be communicated to CLI users?

None, this is an internal chore related to documentation synchronization.

@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented Jun 12, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 12, 2025

Warnings
⚠️

Please make changes to snyk help text in Gitbook. Changes will be automatically synchronised to Snyk CLI as a scheduled PR.
For more information, see: help/README.md.

⚠️ There are multiple commits on your branch, please squash them locally before merging!
⚠️

"[chore: CLI-936 Prepare documentation synchronization scripts for new Gitbook structure](#5955)" is too long. Keep the first line of your commit message under 72 characters.

Generated by 🚫 dangerJS against 41c4b42

@dotkas dotkas force-pushed the dotkas/CLI-936/update-synchronization-scripts branch 2 times, most recently from 2f3a448 to b70c21c Compare June 12, 2025 20:11
@dotkas dotkas force-pushed the dotkas/CLI-936/update-synchronization-scripts branch 4 times, most recently from 48924f3 to 71dec0b Compare June 12, 2025 20:27

- name: Copy help documentation from user-docs to CLI
run: |
cp ./user-docs/docs/snyk-cli/commands/*.md ./cli/help/cli-commands/
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

☝🏻 This part needs to change when the Gitbook CR has been merged. We are unsure about the file names until that happens.


- name: Retrieve GitBook content and update README
run: |
cp ./docs/snyk-cli/getting-started-with-the-snyk-cli.md ./cli/README.md
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

☝🏻 .. and this.

@dotkas dotkas marked this pull request as ready for review June 12, 2025 20:35
@dotkas dotkas requested a review from a team as a code owner June 12, 2025 20:35
@dotkas dotkas enabled auto-merge June 13, 2025 09:58
@dotkas dotkas force-pushed the dotkas/CLI-936/update-synchronization-scripts branch from d3093ac to bf10e87 Compare June 13, 2025 14:22
--title="${{ env.COMMIT_MESSAGE }}" \
--body="Automatic PR controlled by GitHub Action" \
--head "${{ env.DESTINATION_BRANCH }}" \
--base main
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: Let's use the branch we are executing on, so that we can run the automation against a release or release-candidate branch as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think github.ref_name from here could do the job.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh and it would need to be considered in the DESTINATION_BRANCH

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you give a pseudo-suggestion? I get the change from main to a dynamic execution branch, but unsure how env.DESTINATION_BRANCH fits in 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can also push on the branch. The point is just that you can't re-use the same destination branch if the source branch changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The change is in a couple of places, so suggestion might not work in the PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See 41c4b42 and #5971.

It looks a bit funky with all these unrelated files in the PR as well, but I believe it's working as intended for "clean" branches. It wants to merge the new branch with updated docs into this branch. Normally that would be the base branch. LMK

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Possibly a different branch naming strategy? docs/automatic-gitbook-update-cli-help-dotkas/CLI-936/update-synchronization-scripts looks a bit funny.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe just github.ref. 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Or even keep as is but add -from-. Just thinking. 💭

Comment thread .github/workflows/sync-cli-help-to-user-docs.yml Outdated
@dotkas dotkas force-pushed the dotkas/CLI-936/update-synchronization-scripts branch from bf10e87 to 1007ba8 Compare June 16, 2025 16:50
@dotkas dotkas requested a review from PeterSchafer June 17, 2025 10:11
@dotkas dotkas merged commit e13a08c into main Jun 17, 2025
10 checks passed
@dotkas dotkas deleted the dotkas/CLI-936/update-synchronization-scripts branch June 17, 2025 13:38
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.

2 participants