factorio-server-manager icon indicating copy to clipboard operation
factorio-server-manager copied to clipboard

run github actions only once on PR

Open knoxfighter opened this issue 4 years ago • 3 comments

Prevent running the github actions twice, when we create a PR from a branch on this repo.

knoxfighter avatar Jan 29 '21 03:01 knoxfighter

This has only small potential to work! A call to 'actions/cancel-action' needs to have actions:write permission, which it hasn't, when it is called from a PR.

It could work, when it is run from the this repo (which would be fine, cause this code will only run from this repo).

Another point: Get the name of the resulting repo (in case of this PR it would be knoxfighter)

knoxfighter avatar Jan 29 '21 05:01 knoxfighter

It seems like it works, with a custom action i wrote on my user.

Current behaviour will instantly cancel the PR if the base branch is on this repo (hardcoded).

Behavior can also be seen in PR #248 with cancelled build https://github.com/OpenFactorioServerManager/factorio-server-manager/actions/runs/522704849.

@mroote If you're fine with that behaviour, i will move the action also to this org and change it in the workflow.

knoxfighter avatar Jan 30 '21 04:01 knoxfighter

Wow that's cool nice one! This action might be useful to other people too if you want to make it more generalized. Looks good to merge for this repo though.

mroote avatar Jan 31 '21 03:01 mroote