name: blabla bacon n eggs
on:
pull_request:
branches:
- basickarl/gh-actions-pr
defaults:
run:
shell: bash
jobs:
somting:
runs-on: ubuntu-latest
steps:
- run: echo "testy"
I have pushed my code on the branch stated to the origin repo in github. I have created a pull request. I updated some code on the branch and pushed, but the actions is not triggering? How does one trigger a github action workflow when updating a pull request?
The updates to the branch I am making is the workflow file itself.
Here is an example repo: https://github.com/basickarl/github-actions/actions/workflows/test.yaml
For some reason only on: [pull_request] seems to work.
Use types: [synchronize] under on: pull-request:
Related
Currently, my GitHub workflow looks as follows:
name: learn-github-actions
run-name: ${{ github.actor }} is learning GitHub Actions
on:
push:
branches:
- main
jobs:
update-x:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout#v2
with:
# fetch depth is needed since we will be taking git diff with HEAD^1
fetch-depth: 2
- name: Run script
run: scripts/x/x-version-bump.sh
Instead of using git diff in my x-version-bump.sh script I would like to get the changes of the commit pushed via a GitHub action and pass it on to the script. I cannot find a way currently in Github actions to do the same.
I've got Action:
on:
push:
jobs:
test_push_event:
runs-on: ubuntu-latest
steps:
- run: echo 'runs?'
It runs when I push branch from my PC, but doesn't run, when I push branch with my PAT from another scheduled Action.
I've tried to change tokens, still the same.
Updated code is pushed to origin https://{gitHubToken}:x-oauth-basic#github.com/{repositoryOwner}/{repositoryName}.git, may it cause the issue?
I have a publish workflow that is supposed to push the dists to PyPi if a commit on main is tagged with either frontend-v* or backend-v* (both are separate packages)
However, if a commit has changes on both the front- and backend and I add two tags to the commit, the workflow is triggered twice.
I understand that I could simply split the workflow into two, but I have another job that should run if either frontend or backend or both were updated which should only be ran once, thus I want to keep this in one workflow.
Can I somehow circumvent this to run this only once?
Thank you very much!
on:
workflow_dispatch:
push:
branches: [ main ]
tags:
- frontend*
- backend*
jobs:
backend:
name: Publish backend
if: ${{contains(github.ref_name, 'backend') }}
runs-on: ubuntu-latest
steps:
...
frontend:
name: Publish frontend
if: ${{contains(github.ref_name, 'frontend') }}
runs-on: ubuntu-latest
steps:
...
housekeeping: # this should only be ran once for the commit
name: House Keeping
runs-on: ubuntu-latest
steps:
...
I'd like to trigger automatically a GitHub Action Workflow for each [assigned, opened, synchronize, reopened] Git Pull Request from side-branch into master.
In addition, Is there a way to checkout the code from the private repository of a PR via branch name?
Below you can find my GitHub Action workflow that I've tried but unfortunately when I open a PR from side-branch into master it didn't trigger at all.
on:
workflow_dispatch:
pull_request:
types: [assigned, opened, synchronize, reopened]
branches:
- master
jobs:
build-image:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v2
with:
ref: ${{github.event.pull_request.head.sha}}
Is it possible, how can I do that?
I have 3 branches:
develop
test
master
So what I want to do is to setup an automated process to be triggered on test branch getting updated, it will automatically create PR to master.
ie. I create a PR from develop to test then merge, once the merge is completed, I want to setup a GitHub action to automatically create a new PR from test to master.
Is it possible to do this/is there any marketplace action that meet my requirements? Thanks
You can achieve this with create-pull-request. Specifically, this example should help you.
In your case it will look something like this:
name: Create master promotion pull request
on:
push:
branches:
- test
jobs:
masterPromotion:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
with:
ref: master
- name: Reset master branch
run: |
git fetch origin test:test
git reset --hard test
- name: Create Pull Request
uses: peter-evans/create-pull-request#v3
with:
branch: master-promotion