plone / plone.restapi

RESTful API for Plone.
http://plonerestapi.readthedocs.org/
84 stars 75 forks source link

Allow PRs from forks to run tests? #1656

Closed stevepiercy closed 1 year ago

stevepiercy commented 1 year ago

To allow tests to run on PRs from forks, we need to update the GitHub Workflows, similar to what we did in Volto: https://github.com/plone/volto/commit/5808b787230d4049632a4d5b14c3b0a80cc86e77

We restricted access across the Plone GitHub organization for members of Contributors. Members of Developers may write to the repo. See https://community.plone.org/t/gsoc-students-please-focus-on-your-application-restrictions-on-developer-team-access-on-github/17041 for more information.

Refs: https://github.com/plone/plone.restapi/pull/1655

@mauritsvanrees @wesleybl @jensens @fredvd @davisagli

wesleybl commented 1 year ago

@Akshat2Jain would you like to do a PR to fix this? It's basically putting pull_request in on in all .yml files here:

https://github.com/plone/plone.restapi/tree/master/.github/workflows

It is also necessary to put:

if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

in all jobs. See:

https://github.com/plone/volto/commit/5808b787230d4049632a4d5b14c3b0a80cc86e77

wesleybl commented 1 year ago

I see that we now have github actions in many Plone repositories. Should we add this in https://github.com/plone/meta?

CC @gforcada

Akshat2Jain commented 1 year ago

@Akshat2Jain would you like to do a PR to fix this? It's basically putting pull_request in on in all .yml files here:

https://github.com/plone/plone.restapi/tree/master/.github/workflows

It is also necessary to put:

if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

in all jobs. See:

plone/volto@5808b78

Yeah Sure!

if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name

So basically the above code states that this condition ensures that the job is only executed when the event is not a pull request or when the head repository (fork) is different from the base repository.

right? @wesleybl

wesleybl commented 1 year ago

@Akshat2Jain exactly! This prevents jobs from running twice if it's a PR made from the original repository.

gforcada commented 1 year ago

@wesleybl yes, contributions to plone/meta are always welcome, though plone.rest and plone.restapi are still not converted/adjusted to use plone/meta.

@tisto wanted to discuss that during the Bonn sprint, but did not happen 😅 but yeah, in a way or another it will be configured eventually, so contributions there to improve its quality and usability would be great 👍🏾