documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Automatically update submodules when other repos push to `master`

Open stevepiercy opened this issue 2 years ago • 10 comments

Plone Documentation versions affected

  • [ ] 5.x
  • [X] 6.x

Description

Currently whenever there is a push to master for either repo plone/volto or plone/plone.restapi, we manually need to remember to update the submodule. See https://6.docs.plone.org/contributing/index.html#editing-external-package-documentation, Step 7.

cd ../..

# For plone.restapi
git add submodules/plone.restapi
git commit -m "Update submodules/plone.restapi tip"

# For volto
git add submodules/volto
git commit -m "Update submodules/volto tip"

git push

It would be great to handle this automatically in GitHub Actions.

stevepiercy avatar Mar 28 '22 10:03 stevepiercy

Apparently GitHub Actions does not support cross-repository workflows directly. However, here is an article that works around it using curl and secrets to trigger a cross-repository workflow.

https://utensils.io/articles/trigger-github-actions-from-another-repo

See also:

https://github.com/orgs/community/discussions/26323

First we need to create a workflow in this repository that will update the git submodule.

Then we need to work with the Volto team to add secrets to their repo which the Docs Team can provide, create a new workflow that runs only on pushes to master that calls the other workflow, and update .github/workflows/docs.yml to call the new workflow on success. Something like this, I think:

docs.yml success → call-remote-documentation.ymlupdate-submodule.yml

stevepiercy avatar Mar 31 '22 06:03 stevepiercy

@ericof how should secrets be generated and stored for the Plone organization? I can do the work, except for that bit.

stevepiercy avatar Jul 22 '22 22:07 stevepiercy

Reopening per https://github.com/plone/documentation/pull/1346#issuecomment-1283013996

stevepiercy avatar Oct 26 '22 18:10 stevepiercy

@stevepiercy Thanks for your patience. I've updated the workflow so that it now correctly updates submodules. Pushing those changes is proving to be the difficulty right now. If you look at the results of this run, you can see it's found and committed updates to plone.restapi and volto, but can't push them back to 6-dev because of the branch rules.

I'll keep looking to see what I can find for that. If you have any ideas, I'd welcome them.

esteele avatar Nov 05 '22 01:11 esteele

What user attempts to make the push to 6-dev? I can add that user to the authorized members who can do that.

stevepiercy avatar Nov 05 '22 02:11 stevepiercy

For example, I added @esteele to the people who can bypass required pull requests.

Screen Shot 2022-11-04 at 7 52 29 PM

It looks you are not a member of the AI team or Documentation team, so you do not have power to change the repo settings. I can add you as an individual. Please let me know.

stevepiercy avatar Nov 05 '22 02:11 stevepiercy

It looks like bypassing branch protection here may be tricky. There's some discussion at https://github.com/community/community/discussions/13836

davisagli avatar Nov 08 '22 05:11 davisagli

Please visit https://github.com/orgs/community/discussions/13836, upvote and subscribe to that issue.

stevepiercy avatar Dec 22 '22 15:12 stevepiercy

@esteele Steve pointed me to this issue because we had an expiring key on the plone organisation account from October last year. Apparently on that discussion in the previous comment are some interesting pointers to what people are using nowadays.

@stevepiercy If this is still something you want to automate (updating the tips of the submodules) it seem we can do this with a dedication github action that allows you to use a separate Personal Access Token with the right permissions:

https://github.com/ad-m/github-push-action

fredvd avatar Oct 17 '23 08:10 fredvd

@fredvd yes, this is definitely still wanted.

This post might also be helpful.

https://github.com/orgs/community/discussions/26323

stevepiercy avatar Feb 15 '24 08:02 stevepiercy