Skip to content

Conversation

@giordano
Copy link
Contributor

@giordano giordano commented Nov 6, 2025

At the moment post_status assumes source and deploy repos are the same, it's even completely ignoring the argument which holds the source repo.

I don't know how to test this in CI, but I did test it in NumericalEarth/Breeze.jl#77 (comment).

Fix #2814.

At the moment `post_status` assumes source and deploy repos are the same, it's
even completely ignoring the argument which holds the source repo.
Sys.which("curl") === nothing && return
## Extract owner and repository name
## Extract owner and repository names
source_owner, source_repo = split(source, '/')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any chance gha.github_repository includes the .git extension? In that case I'd need to drop it with a regex like done below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hopefully not

github_repository = get(ENV, "GITHUB_REPOSITORY", "") # "JuliaDocs/Documenter.jl"
? Unless someone really calls this constructor directly with the trailing .git.

Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine to assume no .git.

push!(cmd.exec, "https://api.github.com/repos/$(source_owner)/$(source_repo)/statuses/$(sha)")
# Run the command (silently)
io = IOBuffer()
@debug "About to run curl command" cmd
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 was helpful for me for debugging: #2814 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

This would print the token though, so I am a little bit hesitant to add this.

Copy link
Member

Choose a reason for hiding this comment

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

Let's maybe remove this? Or refactor, so that we push! the token after we @debug it? Otherwise, I have no reservations and the PR LGTM.

Suggested change
@debug "About to run curl command" cmd

Copy link
Contributor Author

@giordano giordano Nov 7, 2025

Choose a reason for hiding this comment

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

This would print the token though

Secrets are never printed to screen, they're replaced with asterisks, as in the example I linked above.

Copy link
Member

Choose a reason for hiding this comment

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

Only if you're running things in the context where that is true (like on GHA, where the token is a secret). I'd just prefer to be defensive here and never print the secret.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done.

@navidcy
Copy link
Contributor

navidcy commented Nov 6, 2025

@milankl, with this PR Documenter should show the deploy-docs status even when Documenter pushes on a different repo.

SpeedyWeather/SpeedyWeather.jl#720 (comment)

Copy link
Collaborator

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

I don't claim to understand the details, but (a) I trust @giordano to know what he's doing, and (b) it was tested and worked, so I'd be willing to give it a go

@giordano
Copy link
Contributor Author

giordano commented Nov 7, 2025

I don't claim to understand the details

The post_github_status function adds a custom commit status to GitHub, which has a link to the deployed documentation. It's all good and simple if source repo and target repos are the same (which is what the current implementation implicitly assumed), but for out-of-repo deployments the two repos are different, so we need to add the custom status to the source repo, but the link should point to the target repo. This is what this PR does (or tries to!) 🙂

@fingolfin fingolfin merged commit 334f9d1 into JuliaDocs:master Nov 7, 2025
25 of 27 checks passed
@giordano giordano deleted the mg/post-github-status-deploydoc branch November 7, 2025 15:23
@milankl
Copy link

milankl commented Nov 7, 2025

This is great, thanks @giordano for your work on this: To clarify, would this deploy docs check automatically pop up when a new version of Documenter is released and used in a repo that deploys docs to another repo? Happy to report back here whether this works but do I need to do anything 😉 ?

@giordano
Copy link
Contributor Author

giordano commented Nov 7, 2025

would this deploy docs check automatically pop up when a new version of Documenter is released and used in a repo that deploys docs to another repo?

Yes.

do I need to do anything 😉 ?

No, just wait for next release.

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.

post_status is broken for out-of-repo deployment

5 participants