'Github action does not trigger when I push code from a local to a remote branch
I created a Github action that prints out some strings with the statement. The action triggers when I make commits on github.com, but does not trigger when I make commits locally and push them to the remote repository at github.com. Why is this?
Here is my action...
name: FeatureCI
on:
push:
branches:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run a one-line script
run: echo "Only on featuer branches"
- name: Run a multi-line script
run: |
echo "Only on featuer branches1"
echo "Only on featuer branches2"
Solution 1:[1]
Try simplifying your 'on' trigger. Since you don't care which branch you are pushing to, it can be stated as so:
on: [push]
Solution 2:[2]
I ran into a similar issue. In addition to Lando1n's suggestion, I would recommend making sure that your action file is on the desired feature branch. When you push from feature-branch, Github will only execute actions that are specified in the action file on feature-branch. See my similar answer here.
Solution 3:[3]
Not a solution but in my case, it was just a delay on GitHub side.
After poking around with my workflow .yml file I found nothing wrong, and then GH suddenly started to run my pipelines.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lando1n |
| Solution 2 | Jacob Stern |
| Solution 3 | Evandro Pomatti |
