How to run an action (here: "deploying" through sftp) only when needed?

Hi everyone!

(TL;DR at the bottom)

I’m new to git and gitHub; sorry if my issue sounds newbiesque!
Here is the situation:

  • my repo has 2 basic branches: dev, and prod

  • I’ve setup a pre-push hook for “dev”, useful when I’m working on my computer: I ask winSCP (a ftp client) to synch files with my dev webserver (low cost hosting plan :flushed:).
    It’s basic automation, that allows me to run/test my code (mostly php) in the same conditions than prod (because my local wamp isn’t always reliable) + for other non-coder people working on the project to give me feedbacks on new features.

  • To achieve the same thing when I’m on the go and making edits on my phone, I’ve setup an action on GitHub : FTP Deploy.
    The job takes at least 1mn, but hey, that’s ok.
    I’ve created a new branch: dev_golive, and this action runs on: push: branches: dev_golive.

Now, my issue is this:

  • how to automatically keep “dev_golive” up-to-date with the “dev” branch? Auto-merging?.. Auto-PR?.. Auto “double-push”?..
  • OR, could I delete this branch, and only run the GitHub action when a commit message contains a certain keyword? Maybe that would trigger a tag, or a label, or something that can be recognized as an action event? :thinking:
  • or?..

I’ve looked for actions that can achieve something like this on GitHub marketplace, googled for tutorials, with no avail…
What am I missing? Is there a more obvious way to proceed? :thinking:

TL;DR: The goal is to run an action (in this case: “deploying” through sftp) only when needed. How to run this action on a custom event? Or, if using a specific branch, how to automatically keep that branch in synch with the “main” one?

Thanks a lot. :pray:

Well. Indeed, it was VERY simple. Hours spent finding this… :disappointed:
I just needed to add this line in the yml file, before the action:

if: "contains(toJSON(github.event.commits.*.message), '[somekeyword]')"

Hope that will help someone else.