DEV Community

Discussion on: A Rails and PostgreSQL setup for GitHub actions (CI)

Collapse
 
sabderemane profile image
Sarah Abd

Hi, I've found tricky solution for the manual trigger and also others completed my answer on stack overflow: stackoverflow.com/questions/589331...

Collapse
 
vvo profile image
Vincent Voyer • Edited

Oh wow that's very clever, and I read also the comment on SO from someone saying you could also limit that to the repository owner.

Do you know what it would take to update my current gist to allow for the repository owner, when they star the repo, to trigger a build?

Right now I have:

name: Test

on: [push]

jobs:

what do I need to change? I am new to the syntax :D

Collapse
 
sabderemane profile image
Sarah Abd • Edited

Alright, you can try this :

name: Test

on:
  watch
    types: [started]

jobs:
  build:
    runs-on: ubuntu-latest

    if: github.actor == github.event.repository.owner.login

    steps:
       - name: Checkout repository
         uses: actions/checkout@v2
        #  add more ...

Notice you may have to reindent but I hope it would be fine :)

Thread Thread
 
vvo profile image
Vincent Voyer

Thanks, I guess the last step is on how to combine what you propose with an already in place workflow that gets executed at push time.

For now I have:

name: Test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
[...]

But if I change that to what you propose then my workflow is no more executed at push time.

Do you know if we can combine both manual trigger trick + usual push testing in a single or a combination of workflows maybe? Let me know!

Thread Thread
 
sabderemane profile image
Sarah Abd

Yes, I set just the beginning but you can adapt it for an existing workflow or a new one.

can combine both manual trigger trick + usual push testing in a single or a combination of workflows

Yes you can !
For your example it will be like that :

on:
  push:
  watch:
    types: [started]

jobs:
  build:
    runs-on: ubuntu-latest

    if: github.actor == github.event.repository.owner.login

    steps:
[...]

I din't try out yet this but I've already tried to setup a workflow with push event and cron, so it should be fine !