-
Notifications
You must be signed in to change notification settings - Fork 5
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
Site preview build and xref validation not correctly done when the PR is created from a fork repository #402
Comments
|
ℹ️ Here is my proposals based on my investigations Build previewWhen building the preview for fork repositories, we need to use the URL of the fork repository. This is not possible today with the preview script, as we use the component name and the script automatically selects the repository URL. Using the dedicated URL when building the preview also has an additional advantage. It correctly set the link in the built preview for page edits. It will help the contribution workflow: download the preview archive, browse it locally, find a typo, click on the "edit this page link", update on GitHub UI, commit, check the newly built preview. This new option may also allow to build the preview of a new component under development prior it is registered in the build preview script or for a poc without having to update the script logic. Build Site (used to validate reference)🚧
Taskspreview
As part of the change, we could rename the "ignore-errors" (it currently misses a trailing s) of the "build-preview" script build-site |
This week, we got a contribution from a forked repository on Bonita-doc. I download logs of two actions: Publish Preview and Validate Xref. |
…698) Let pass the git repo url to the preview script: - Only valid for a branch preview for a component. - This allows you to use an alternative URL to the one configured for the component, in particular to use a fork. The "build-and-publish-pr-preview" and the "build-pr-site" (used for references validation) actions set this new argument to use the git URL of the branch of the PR This ensures that the git URL of the repository whose the PR is originated from is used (fork or upstream repository). Covers #402
This applies to the "build preview" and the "references validation". The content of the branch of the fork is now correctly used. Previously, the branch of the fork wasn't found by Antora, so the content of the generated site was empty. ### Notes Covers bonitasoft/bonita-documentation-site#402 This depends on bonitasoft/bonita-documentation-site#698
"contribution checks" The workflow now runs on `pull_request_target` events. There are no security issues here. Checks are made only on the updated PR file without doing any tool installation, cache update or branch check. Only the GitHub API is used. Using this event allows you to create a PR comment when the PR is created from a forked repository. "build preview" and "references validation" workflows. The content of the branch of the fork is now correctly used. Previously, the branch of the fork wasn't found by Antora, so the content of the generated site was empty. ### Notes Covers bonitasoft/bonita-documentation-site#402 Covers bonitasoft/bonita-documentation-site#685
"contribution checks" The workflow now runs on `pull_request_target` events. There are no security issues here. Checks are made only on the updated PR file without doing any tool installation, cache update or branch check. Only the GitHub API is used. Using this event allows you to create a PR comment when the PR is created from a forked repository. "build preview" and "references validation" workflows. The content of the branch of the fork is now correctly used. Previously, the branch of the fork wasn't found by Antora, so the content of the generated site was empty. ### Notes Covers bonitasoft/bonita-documentation-site#402 Covers bonitasoft/bonita-documentation-site#685
"contribution checks" The workflow now runs on `pull_request_target` events. There are no security issues here. Checks are made only on the updated PR file without doing any tool installation, cache update or branch check. Only the GitHub API is used. Using this event allows you to create a PR comment when the PR is created from a forked repository. "build preview" and "references validation" workflows. The content of the branch of the fork is now correctly used. Previously, the branch of the fork wasn't found by Antora, so the content of the generated site was empty. ### Notes Covers bonitasoft/bonita-documentation-site#402 Covers bonitasoft/bonita-documentation-site#685
"contribution checks" The workflow now runs on `pull_request_target` events. There are no security issues here. Checks are made only on the updated PR file without doing any tool installation, cache update or branch check. Only the GitHub API is used. Using this event allows you to create a PR comment when the PR is created from a forked repository. "build preview" and "references validation" workflows. The content of the branch of the fork is now correctly used. Previously, the branch of the fork wasn't found by Antora, so the content of the generated site was empty. ### Notes Covers bonitasoft/bonita-documentation-site#402 Covers bonitasoft/bonita-documentation-site#685
All tasks are completed, so closing. |
ℹ️ Part of a top-level initiative: #670
This causes issue when using the new doc-site surge-preview action (developed in #378) for #239 and #270
Previously, we didn't build the preview in such case. Since we build it (but don't deploy it), we see new errors: the branch of the PR is not part of the site build.
[UPDATE 2024-03-27]
The xref validation fails as some other components need it.Detected in bonitasoft/bonita-doc#2058 (comment)
The xref validation is not done as well, the branch of the PR is no available as well (use the same commands as to build the preview)
I have started to fix the issue in bonitasoft/bonita-doc#2108: it targets "2021.1" which only build the PR branch and no extra component.
The current build preview command is
There is no build error, but the generated site is empty and there is no warning.
Root cause
The branch of the fork repository is not available in the repository under the name it has been created in the fork repository ("patch-1" in our example).
So when Antora builds, it tries to checkout it, and as it is not available, ignores it.
Attempt to fix
Currently, we compute the PR branch with
echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF#refs/heads/})" >> $GITHUB_ENV
What we could try
GITHUB_REF
orgithub.ref
(refs/pull/<pr_number>/merge)Already tested and does not work
GITHUB_HEAD_REF
orgithub.head_ref
:patch-1
GITHUB_REF_NAME
orgithub.ref_name
:2108/merge
pull/${{ github.event.pull_request.number }}/head
Resources
Implementation tasks
The text was updated successfully, but these errors were encountered: