website icon indicating copy to clipboard operation
website copied to clipboard

chore(github-actions): update contributor and project sync workflows

Open aialok opened this issue 1 year ago • 12 comments

What kind of change does this PR introduce?

  • Since we have branch protection rules, automated commits can't be made. Therefore, both workflows will now create pull requests instead.

Issue Number:

  • None

Screenshots/videos:

If relevant, did you update the documentation?

Summary

Does this PR introduce a breaking change?

aialok avatar Aug 16 '24 21:08 aialok

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview f3ea9d4011695a6373cec16707c4b5f1259beca8

github-actions[bot] avatar Aug 16 '24 21:08 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (cc3ce3e) to head (f3ea9d4). Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #869   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           20        20           
  Branches        12        12           
=========================================
  Hits            20        20           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 17 '24 05:08 codecov[bot]

Great job with this!

Could it be possible to add another step to approve and another one to merge?

I don't think it's possible to do this within the same workflow since we need to create the pull request first which take time, then approve it, and finally merge it. But lemme check.

However, it could be easily done with a separate workflow.

aialok avatar Aug 17 '24 08:08 aialok

However, it could be easily done with a separate workflow.

We'll need to do something to avoid the cumulation of unreviewed PRs.

benjagm avatar Aug 17 '24 09:08 benjagm

However, it could be easily done with a separate workflow.

We'll need to do something to avoid the cumulation of unreviewed PRs.

I will be creating another workflow to approve and merge the pr.

aialok avatar Aug 17 '24 12:08 aialok

Added auto approve and auto merge in the same workflow.

aialok avatar Aug 17 '24 17:08 aialok

For auto merge, these condition must be true: image

https://github.com/peter-evans/enable-pull-request-automerge?tab=readme-ov-file#conditions

aialok avatar Aug 17 '24 17:08 aialok

Added auto approve and auto merge in the same workflow.

This seems like a bad idea. (Unless I'm misunderstanding what's being added.)

It seems like you're wanting an action to automatically approve and merge PRs? Why? PRs are intended for review... by humans.

gregsdennis avatar Aug 17 '24 19:08 gregsdennis

Added auto approve and auto merge in the same workflow.

This seems like a bad idea. (Unless I'm misunderstanding what's being added.)

It seems like you're wanting an action to automatically approve and merge PRs? Why? PRs are intended for review... by humans.

Basically, both workflows work to fetch the latest contributor data and our roadmap project data and save it in a file. This allows us to use the data on our website, helping to reduce the number of API calls to GitHub by using the data directly from a JSON file. There is nothing to review since both are just json file.

And since we have branch protection rule we can't directly push to main branch. We need to create pull request first.

https://github.com/json-schema-org/website/pull/869#pullrequestreview-2244053294

aialok avatar Aug 17 '24 20:08 aialok

And since we have branch protection rule we can't directly push to main branch. We need to create pull request first.

Then maybe this repo isn't the best place to store the results of the data fetch. Maybe we store it in another repo (or a gist) where only the bot has push rights (and maybe the project admins). I use a gist to store some data for a custom badge on my repo (action).

Automation like this seems subversive to me. When I encounter hacks like this, it usually means I've taken a wrong turn somewhere; that I'm doing something wrong.

gregsdennis avatar Aug 17 '24 22:08 gregsdennis

Automation like this seems subversive to me. When I encounter hacks like this, it usually means I've taken a wrong turn somewhere; that I'm doing something wrong.

Hi everyone here. This is the solution I suggested and I take responsibility. The fetched files will be used to build a future roadmap page and improve the current community page. We are storing the data to avoid doing synchronous API calls and avoid rate limit issues. I understand your concerns and I am happy to discuss alternatives. Gist seems like over-complicating things but I have never implemented it before. I know that AsyncAPI is doing something similar to us in their repository.

benjagm avatar Aug 17 '24 22:08 benjagm

I expect you're looking at something like https://github.com/asyncapi/website/pull/3142?

If that's the direction you want to go, okay. I've given my opinion.

gregsdennis avatar Aug 17 '24 23:08 gregsdennis