Comments (4)
Thanks, how is it different from:
- if: {{ github.ref_name != 'main' }}
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
Which is what we're currently using and which is not working: https://github.com/tensorflow/datasets/blob/076de8657a32bac79fad46644c1a4ba24e1a8d7b/.github/workflows/pytest.yml#L17
It looks like your solution is only triggering cancel
event when the "push" is not the main
branch. But it doesn't prevent cancel
to cancel actions in the main branch.
For example, a push on branch A
will trigger a cancel
event, which will cancel the current tests on the main
branch. This will make our tests red.
Maybe it would be nice to add some:
- uses: styfle/[email protected]
with:
do_not_cancel_branch: 'main'
access_token: ${{ github.token }}
So the event is triggered on all branch (including main
), but never the cancel "main" tests
from cancel-workflow-action.
For update, we ended up not using cancel-action but instead use the native cancel-in-progress
feature from Github:
# Cancel in-progress runs for the current workflow if not on the main branch
# (as it mark the unittests as failed).
# Conditionals to concurrent are based on the solution proposed in this link:
# https://github.community/t/concurrency-cancel-in-progress-but-not-when-ref-is-master/194707
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || github.run_number }}
# Cancel only PR intermediate builds
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
from cancel-workflow-action.
I use a separate workflow to control the push events that should cancel.
Then pass the workflow ids that should be canceled:
name: Cancel
on:
push:
branches:
- '**'
- '!main'
jobs:
cancel:
name: 'Cancel Previous Runs'
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: styfle/[email protected]
with:
workflow_id: 849295, 849296, 849297, 849298
access_token: ${{ github.token }}
from cancel-workflow-action.
It looks like your solution is only triggering cancel event when the "push" is not the main branch. But it doesn't prevent cancel to cancel actions in the main branch.
It does prevent canceling the main branch. The current branch is considered for cancelation here
cancel-workflow-action/src/index.ts
Lines 22 to 30 in dffcefd
So if you never run on the main branch then it wont cancel the main branch.
from cancel-workflow-action.
Related Issues (20)
- `Error: Not Found` when running action HOT 3
- Prints a lot details and makes action messier. HOT 4
- GitHub Action marketplace page not updated with latest version info HOT 1
- Fork-based setup seems to cancel itself and not the target workflows HOT 7
- Finding 0 runs HOT 5
- Actions now has built-in cancelation HOT 2
- Does this work on prs? HOT 1
- cancel workflow without email? HOT 2
- possible to cancel previous workflows only when a specific job has not been started? HOT 1
- how to make a cancelled workflow count as skip instead of failed? HOT 3
- Use Node.js v16 HOT 2
- Cancelling the current run HOT 2
- Archive this repo HOT 3
- error message using this step HOT 5
- It should cancel all instances of running workflow when workflow name in workflow_id is specified HOT 3
- Cancel Actions Got A Error HOT 1
- Flag to pick `in_progress`, `waiting` or both to be canceled HOT 2
- Deprecation warning for use of Node 16
- Azure Pipelines alternative HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cancel-workflow-action.