catalyst / catalyst-moodle-workflows

4 stars 9 forks source link

Update CI to by default, reference it's own calling branch e.g. @main or @some-branch, if not provide an option to test a different branch #62

Closed keevan closed 2 years ago

keevan commented 2 years ago

This should alleviate some annoyances when it comes to testing a workflow PR, because many of the references in ci.yml reference the main branch of the workflows.

This potentially could be another option provided to ci.yml but defaulting to main.

A better option would be to default to whatever the current reusable workflow branch it is currently on, but unsure if there's an option for that.

brendanheywood commented 2 years ago

+1

keevan commented 2 years ago

Was about to create another issue but adding details to this is better:

Apparently this "problem" has been resolved https://github.blog/changelog/2022-01-25-github-actions-reusable-workflows-can-be-referenced-locally/ so we should be able to point the actions used locally and it should just work, which means we shouldn't need yet another branch with pointers to our test branch to ensure actions are working.

If what I just said sounded messy, it really was and so fixing this should make it so if you created a PR with some changes, you only need to point the CI at the PR branch, and it should just work.

keevan commented 2 years ago

So previous link though true, didn't really work in this case.

I did try various options provided on StackOverflow:

Ultimately, it only worked in using what was available in the plugin repo, not the reusable one which was what I wanted instead. I combined a bit of this and that, and I believe I've found a mix that is "good enough" for now. It does require an option to be passed through, slightly redundant as there didn't seem to be any direct way of referencing that piece of information. A slightly better option considered was parsing the ci file that was called from the plugin, and wrangling the branch name out of the use line but that seems more likely to have issues, at least initially.

The changes will come in at the same time as the phpdoc fixes