Skip to content

Conversation

desrosj
Copy link
Member

@desrosj desrosj commented Jul 18, 2025

Proposed changes

Currently, when someone creates a pull request, workflows can run twice when the HEAD branch uses a certain naming convention. A few examples of this are release/*, feature/*, and fix/*.

I'm unsure if I'm missing a reason why this is configured this way intentionally. But unless a branch is a canonical place for code (main for publicly released code, develop for in progress work), then the workflows should only trigger when the pull request is opened. Otherwise someone could be pushing code to various branches and unknowingly triggering workflow runs. A pull request is a more intentional "I am submitting this for review, so testing should now occur" point.

I've also removed the (develop|master)-2-x references as those branches don't appear to exist in this repository.

Lastly, I've included a formatting change that wraps each branch in single quotes (') for consistency.

Type of Change

Production

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Visual

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Currently, when someone creates a pull request, workflows can run twice when the HEAD branch uses a certain naming convention.

A few examples of this are `release/*`, `feature/*`, and `fix/*`. Unless a branch is a canonical place for code (`main` for publicly released code, `develop` for in progress work), then the workflows should only trigger when the pull request is opened.
@desrosj desrosj requested a review from wpscholar July 18, 2025 17:15
@desrosj desrosj self-assigned this Jul 18, 2025
@Copilot Copilot AI review requested due to automatic review settings July 18, 2025 17:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines branch filtering for GitHub Actions workflows to prevent duplicate runs when feature branches are pushed and pull requests are created. The changes restrict push event triggers to only canonical branches (main and develop) while maintaining pull request triggers for all branches.

  • Removes wildcard patterns like release/*, feature/*, fix/* from push triggers
  • Standardizes branch name syntax to use quoted strings
  • Ensures workflows only run on push for main branches, preventing duplicate executions

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/workflows/workflow-lint.yml Adds quotes around branch names for consistency
.github/workflows/upload-artifact-on-push.yml Removes feature branch patterns, keeps only main/develop
.github/workflows/lint.yml Replaces wildcard '**' with specific main/develop branches
.github/workflows/eslint.yml Removes multiple branch patterns and legacy names (master, trunk)
.github/workflows/deploy-and-test.yml Adds quotes around main branch name
.github/workflows/cypress.yml Removes feature branch patterns, keeps only main/develop
.github/workflows/cypress-matrix.yml Adds quotes around main branch name
Comments suppressed due to low confidence (1)

.github/workflows/eslint.yml:13

  • There's an extra single quote at the end of the line that should be removed. This appears to be a typo in the original file.
      - 'src/**/*.js'

@circlecube
Copy link
Member

FWIW, I don't think this was put in place intentionally like this. I think a few changes have occurred to get us to this point. We just updated concurrency, so I imagine that affected this. I have noticed some duplicate jobs running in PRs (test and build specifically). Initially we had all the branches listed to try to enforce branch naming conventions, that isn't always respected though and there's a trend to use just a ticket number as branch name, so removing the naming conventions from the workflow might be nice to account for those times where workflows don't run as expected when a branch doesn't match convention.

PRs opened against 'main' and 'develop' should be the norm, with this update, do those run tests on a new push to an existing branch with a PR?

@desrosj
Copy link
Member Author

desrosj commented Jul 18, 2025

With this PR, the workflows will run on

@desrosj desrosj merged commit eb3cc3e into main Jul 23, 2025
36 checks passed
@desrosj desrosj deleted the refine/branch-filtering-for-push-events branch July 23, 2025 19:54
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

Successfully merging this pull request may close these issues.

3 participants