CI assumes branch name
- Dominant language
- Rust
- Stars
- 543
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
In two places in the CI (and at two in the doc-comments) the branch name is assumed to be `main` (vs `master`, `trunk`, etc.).
This will silently break the CI and leave the user (who presumably was attempting to avoid workflow yml mucking) to find out why the ci won't run correctly. Whatever one's feelings on branch naming a great many projects cannot practically change their name (and all downstreams names and remotes) and `master` remains the default branch created by `git`, e.g. when a beginner is early in their explorations.
Taking primary branch name as a variable would likely be the simplest workaround. If detecting all branches to search for common branch names were practical that would be ideal. But, if neither of those occurs, a very bold warning that the branch name may need to be manually edited would likely be wise.
```yml
on:
...
# Whenever something gets pushed to main, update the docs! # <<<<<<<<<<<<<<<<< (comment a)
...
push:
branches:
- main # <<<<<<<<<<<<<< (1)
# ONLY if we're on main (so no PRs or feature branches allowed!)
if: ${{ github.ref == 'refs/heads/main' }}
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4.4.1
# ONLY if we're on main (so no PRs or feature branches allowed!) # <<<<<<<<<<<<<<<<<<< (comment b)
if: ${{ github.ref == 'refs/heads/main' }} # <<<<<<<<<<<<<<<<<<< (2)
with:
branch: gh-pages
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.