Re: [LTP] [PATCH v2 1/1] ci: Add hook to mirror docparse to homepage

Richard Palethorpe
2022-12-15T09:31:46Z

Hello,

Petr Vorel <pvorel@suse.cz> writes:

> Hi Richie,
>
> first, thank you for your review!
>
>> Hello,
>
>> Petr Vorel <pvorel@suse.cz> writes:
>
>> > GitHub Actions git push hook generates metadata HTML and push it
>> > to LTP homepage.
>
>> > Hook pushes only if there are actual changes in generated doc.
>
>> IIUC we have to do most of the work to generate the meta data, but then
>> don't push it if there is no diff?
>
>> What are we saving with this optimisation?
>
> This saves number of commits which will change nothing.
> Because the page itself has also other changes for the web page itself,
> which will be buried with these changes.
> But sure, I'll remove this check, if considered useless.

I think the root of the problem is that we are publishing to a branch
which makes sense if we write the HTML by hand.

However we are generating it from multiples sources. So this doesn't
work well with Git.

Why not use the upload assets method?:

https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#creating-a-custom-github-actions-workflow-to-publish-your-site

>
> If your comment is about to do the detection earlier,
> I'd have to do some smart 'git diff'. Could be done with:
> git diff $old_commit testcases/ | grep '^+ \* '
> in step "Check metadata need to be updated"
> (i.e. after both checkouts).
>
>
>> > NOTE: this change requires to add:
>
>> > 1) Personal Access Token (PAT) to any developer which has write access
>> > to homepage git repository [3]. In Developer settings -> Personal access
>> > tokens -> Tokens (classic) [4]), where set:
>> > Note: GH_PERSONAL_ACCESS_TOKEN
>> > Select scopes: public_repo (minimal permission)
>> > Expiration: either never or regularly renew.
>
>> > 2) Allow PAT in LTP organisation (I dared to already set it)
>> > Iin linux-test-project group -> Settings -> Third-party Access -> Personal
>> > access tokens -> Settings [5]
>> > select:
>> > Allow access via personal access tokens (classic)
>> > API and Git access will be allowed using an organization member's personal access token (classic)
>
>> > 3) Add repository action secret to ltp repository
>> > IN Settings -> Actions -> New repository secret [6]:
>> > name: GH_PERSONAL_ACCESS_TOKEN
>> > value: the value of previously created token.
>
>> > Because using token, default permission is just read.
>
>> This seems like a very convoluted process. Can't we just put the
>> metadata generation in the docs build and upload the assets as usual?
>> I've never had to use a PAT to deploy a github page.
>
> Do you mean to have this Action in linux-test-project.github.com git repo?
> What would trigger the build? Some kind of cron behavior?
> Using PAT is a weak point thus I'm really open to other solutions.

I guess a github action can be triggered by multiple sources, including
other actions and the assets from one action should be available in the
next.

I'm more familiar with GitLab, but this is basic build pipeline stuff,
so GitHub should support it.

--
Thank you,
Richard.