pcdshub / BEAMS

Beamline Engineering Automation Management Systems
Other
1 stars 2 forks source link

Github actions workflow runs twice for PR'd in-repo branches #55

Open ZLLentz opened 1 month ago

ZLLentz commented 1 month ago

Current Behavior

If you make a branch in BEAMS, the github actions workflow will run. If you make a PR in BEAMS, the github actions workflow will run.

If you make a PR of a branch in BEAMS, the github actions workflow will run twice and show up doubled in the PR.

This is because the (standard) github actions config we use has workflow triggers both on "push" and on "pull request". If using only forks, the effect of the "push" workflow trigger is only ran on merges to master. Here, since we're using local branches, we get to see double.

Expected Behavior

Workflows here should only run once each during a PR. Learning from fixing this issue should be replaced in our templates/best practices.

Steps to Reproduce (for bugs)

  1. Make a new branch in pcdshub/BEAMS
  2. PR your branch into the default branch
  3. Peek at your "checks" section.

Suggested Solution

I'm not entirely sure where to start here

tangkong commented 1 month ago

If we were forking properly, and as prescribed, this wouldn't be an issue. Realistically this is something we should fix in ci-helpers, I remember looking into this but not turning up a concise way to layer the triggers. I may be mistaken though

tangkong commented 1 month ago

I lied, this is something to fix on the per-repo invocation. (workflow file). Maybe it really is as simple as something like:

  push:
    branches:
      - master
  pull_request:
    types: [ opened, synchronize, reopened ]
    branches:
      - master