Splitting Actions and duplicate runs when there's a PR made by a collaborator

I was trying to find a way to speed up our Actions CI and I ended up splitting the 3 actions in smaller ones. It’s definitely faster already and when we have caching it should be even faster. Also, this circumvents the issue with not being able to restart a single check. Here is a WIP branch and the related PR.

Now, one thing I don’t like with this approach is that when one of the team members makes a PR, we end up running all (minus the BrowserStack action which is set to fire only on push) actions twice.

I was wondering, is there any clever way to have the actions fire on push from team members, on PRs from outsiders, but allowing to skip some of the actions if one team members opens a PR?


You can make entire jobs or certain steps conditional with the “if” statement. There are several ways to checking if someone is a “team member”, by either using the API or keeping a list in your action itself. A very basic example would be to check who the “actor” (initiator) of the action is and skip a step if it is not a “known” user:

  - name: Run this for everyone
    run: npm install

  - name: Run this for everyone except user OctoCat
    if: github.actor != "OctoCat"
    run: echo Hello world

First of all, thanks for the reply :slight_smile:

Now, the thing is that I don’t want us to keep a list. I thought about github.actor but I couldn’t find (an easy) way to check if the the actor has push rights.