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

Actions: Deploy preview docs #66

Merged

Conversation

codeallthethingz
Copy link
Contributor

@codeallthethingz codeallthethingz commented Nov 24, 2024

This PR creates a set of hidden docs on readme.com with a version matching the current version of the docs up to the minor version + the branch name made safe for metadata on a semver version.

For example, this branch: 0.0-deploy-preview-docs

While building it puts a sticky note on the PR's comments

Building:
image

Finished:
image

Failure:
Similar to building but with a ❌

This PR needs some action secrets / vars to be created.

Note

Currently preview docs are not deleted when they are merged to main, this will be done in a separate PR.

@codeallthethingz codeallthethingz marked this pull request as draft November 24, 2024 14:11
@codeallthethingz codeallthethingz marked this pull request as ready for review November 24, 2024 14:27
@codeallthethingz codeallthethingz added infrastructure Changes to infrastructure triaged This issue or pull request was triaged labels Nov 24, 2024
@codeallthethingz
Copy link
Contributor Author

@tristanls I'm flummoxed. None of the docs.yml actions are running and I need help to figure out why.

@tristanls
Copy link
Contributor

@codeallthethingz actions will not pass secrets on pull_request trigger event. It'll need to be pull_request_target and in main before it passes secrets. This is what happened with CLA check.

@codeallthethingz
Copy link
Contributor Author

Ah, right! Thanks.

@codeallthethingz
Copy link
Contributor Author

I tried to add a trigger of both pull_request and pull_reqeust_target the docs.yml, but I feel like the entire file is skipped if there is a reference to a secret in it, which I think means I need to split the docs.yml into two - one for the secretless check-docs and one for the secretfull preview-docs. Do I have that right?

@codeallthethingz
Copy link
Contributor Author

Update as this has been fallow for a while.

I stopped using the pin-comment third party tool and wrote an action that does the same thing.

I've tested the preview docs as a pull_request triggered build, but have put it back as a pull_request_target for the code review. Which means it won't successfully run until we merge and open a new PR.

Copy link
Contributor

@tristanls tristanls left a comment

Choose a reason for hiding this comment

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

Looks great! I added some comments, but nothing exciting.

Comment on lines 45 to 46
response=$(curl -s -w "%{http_code}" -H "Authorization: token ${GITHUB_TOKEN}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments")
Copy link
Contributor

@tristanls tristanls Jan 9, 2025

Choose a reason for hiding this comment

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

issue (non-blocking): This will fail to find the pinned comment if it is beyond the first page of results. I made this issue non-blocking since making new comments over and over is not the worst.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Not the worst. I think I'll increase the page size to 100, but if it's bigger than that I'd rather create a new comment than spend a bunch of action credits looking for a comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

issue (blocking): Please rename to docs_preview.yml to match the existing monty_api_docs.yml.

@@ -90,7 +90,8 @@ jobs:
echo $changed_file
if [[ $changed_file == docs/* ]] ||
[[ $changed_file == tools/github_readme_sync/* ]] ||
[[ $changed_file == .github/workflows/docs.yml ]]; then
[[ $changed_file == .github/workflows/docs.yml ]] ||
[[ $changed_file == .github/workflows/docs-preview.yml ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

question: Why run the Docs workflow when docs_preview.yml changes?

Copy link
Contributor

@tristanls tristanls left a comment

Choose a reason for hiding this comment

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

Looks good.

@tristanls tristanls enabled auto-merge (squash) January 9, 2025 22:24
@tristanls tristanls merged commit 381f052 into thousandbrainsproject:main Jan 9, 2025
13 checks passed
@codeallthethingz codeallthethingz deleted the deploy-preview-docs branch January 9, 2025 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Changes to infrastructure triaged This issue or pull request was triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants