smarkets / marge-bot

A merge-bot for GitLab
BSD 3-Clause "New" or "Revised" License
700 stars 136 forks source link

Make CI work with GitHub Actions #308

Closed nejch closed 3 years ago

nejch commented 3 years ago

This will need two secrets configured by an admin in order for the DockerHub deploy to really work: DOCKER_USERNAME and DOCKER_PASSWORD, to replace encrypted secrets previously committed in the .travis.yml config.

This probably also needs an additional approval for every first contribution (see: https://github.blog/changelog/2021-04-22-github-actions-maintainers-must-approve-first-time-contributor-workflow-runs/) but here is an example run from my fork: https://github.com/nejch/marge-bot/actions/runs/833323869

Helps with https://github.com/smarkets/marge-bot/pull/283 not running CI

matthiasbalke commented 3 years ago

+1 for migrating to GitHub actions, which is a more modern and flexible build system. Thanks @nejch for your work!

qqshfox commented 3 years ago

+1 for GitHub actions.

Do I need to configure/approve something to let actions triggered for this MR? I didn't find any jobs triggered.

nejch commented 3 years ago

Thanks for the really quick feedback guys!

@qqshfox yes, I believe you need to "Approve and run". Do you see the setting in this PR as shown in the article below? https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks

Otherwise, perhaps Actions are disabled but I doubt it. Here are docs for enabling them: https://docs.github.com/en/actions/managing-workflow-runs/disabling-and-enabling-a-workflow

Btw, you will need to do the Approve and Run every time a new contributor opens a PR for the first time, which is slightly annoying, but the "Auto-merge" option makes that better as you can approve and run, then auto-merge will just wait for the pipeline to succeed like in GitLab.

Edit: I opened a PR against my own fork just to verify there is no issue with the execution logic in the workflow, see https://github.com/nejch/marge-bot/pull/1.

qqshfox commented 3 years ago

Hmmm... Interesting... I don't find "Approve and run" anywhere. I even checked settings and it says Allow all actions. Probably the same reason (Github issue?) why travis isn't triggered?

qqshfox commented 3 years ago

Will actions be triggered when lacking secrets? I'm still asking my colleague to configure DockerHub credentials.

nejch commented 3 years ago

@qqshfox hmm that is strange, what happens if you pull my branch and push it to the main repo and open a draft PR, just to see if the problem is with forks? Maybe it needs to be merged first, but I'm surprised it doesn't work 😁

Generally actions should still run yes, but fail because of the missing environment variables (on master only, this only applies to the dockerhub job).

qqshfox commented 3 years ago

Opened a PR and an action kicked in immediately. At the same time this PR now has a check referring to that action.

qqshfox commented 3 years ago

Everything LGTM. I'll merge when DockerHub credentials configured.

qqshfox commented 3 years ago

Fixed a syntax error in deploy action. Now it built and pushed the latest tag.

https://github.com/smarkets/marge-bot/commit/b5274b878a2db57a1d6542c5a3640741ae5b684e

nejch commented 3 years ago

Fixed a syntax error in deploy action. Now it built and pushed the latest tag.

b5274b8

Oops, sorry had no way of testing that one without creating dummy stuff. Thanks :)