Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI assumes branch name #709

Open
ethanmsl opened this issue Sep 8, 2024 · 0 comments
Open

CI assumes branch name #709

ethanmsl opened this issue Sep 8, 2024 · 0 comments

Comments

@ethanmsl
Copy link

ethanmsl commented Sep 8, 2024

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.

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/[email protected]
        # 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant