OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
541 stars 130 forks source link

run github actions only once on PR #246

Open knoxfighter opened 3 years ago

knoxfighter commented 3 years ago

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

knoxfighter commented 3 years ago

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 commented 3 years ago

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.

mroote commented 3 years ago

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.