I have the following .github/workflows/ci.yml file for GitHub Actions (some code removed to make it easier to understand for this question):
name: CI
on:
push:
release:
types: [published]
jobs:
test:
runs-on: ubuntu-latest
steps:
# ...
deploy-staging:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'staging'
steps:
# ...
I went through the following steps:
- Make some commits on the
developbranch, and push those changes. - After build passes on GitHub Actions I did a fast forward merge from
developintostaging.
I expected GitHub Actions to run both the test and deploy-staging jobs after item 2. But instead it just ran test again without running deploy-staging.
As you can see above even after pushing to staging it still ran it on the develop branch instead of the staging branch. I'm kinda assuming this might be due to some weird behavior with fast forward merges. But GitHub obviously recognized that I pushed to staging as it offered to create a PR from that branch into master.
So that makes me rethink my theory about why it's trying to run on develop instead of staging.
Why would this be happening? Is there anyway to fix this so merging into staging actually runs the workflow on staging as opposed to develop?


deploy-stagingjob, on thedevelopmentbranch, or did it simply fail but did not run any steps? Github actions has a bug where it marks jobs which do not meet a condition as failed rather than as "Not run". That's why you need to specify exactly what happened. There are other ways to fix the issue you are having, but I need to know exactly what you experienced. - smac89