You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/01/24 07:40:51 UTC
[GitHub] [superset] potiuk commented on a change in pull request #12625: fix(CI): properly configure cancel duplicates
potiuk commented on a change in pull request #12625:
URL: https://github.com/apache/superset/pull/12625#discussion_r563252001
##########
File path: .github/workflows/cancel_duplicates.yml
##########
@@ -1,25 +1,33 @@
name: Cancel Duplicates
on:
- workflow_run:
- workflows: ["CI"]
- types: ["requested"]
+ # Checks for duplicate jobs on every push (merge) and every 10 minutes
+ push:
+ schedule:
+ - cron: "*/10 * * * *"
jobs:
- cancel-duplicate-workflow-runs:
- name: "Cancel duplicate workflow runs"
- runs-on: ubuntu-latest
+ cancel-duplicate-runs:
+ name: Cancel duplicate workflow runs
+ runs-on: ubuntu-20.04
+ continue-on-error: true
steps:
- - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
- uses: actions/checkout@v2
- with:
- persist-credentials: false
- submodules: recursive
- - uses: ./.github/actions/cancel-workflow-runs/
+ - name: Check number of queued tasks
+ id: check_queued
+ run: |
+ count=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
+ "https://api.github.com/repos/${{ github.repository }}/actions/runs?status=queued,in_progress" | \
+ jq ".total_count")
+ echo "Found $count unfinished jobs."
+ echo "::set-output name=count::$count"
+ if [[ $count -lt 20 ]]; then
+ echo "Less than 20 pending workflows runs, skip cancelling..."
+ exit 1
+ fi
Review comment:
```suggestion
```
##########
File path: .github/workflows/cancel_duplicates.yml
##########
@@ -1,25 +1,33 @@
name: Cancel Duplicates
on:
- workflow_run:
- workflows: ["CI"]
- types: ["requested"]
+ # Checks for duplicate jobs on every push (merge) and every 10 minutes
+ push:
+ schedule:
+ - cron: "*/10 * * * *"
jobs:
- cancel-duplicate-workflow-runs:
- name: "Cancel duplicate workflow runs"
- runs-on: ubuntu-latest
+ cancel-duplicate-runs:
+ name: Cancel duplicate workflow runs
+ runs-on: ubuntu-20.04
+ continue-on-error: true
steps:
- - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
- uses: actions/checkout@v2
- with:
- persist-credentials: false
- submodules: recursive
- - uses: ./.github/actions/cancel-workflow-runs/
+ - name: Check number of queued tasks
+ id: check_queued
+ run: |
+ count=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
+ "https://api.github.com/repos/${{ github.repository }}/actions/runs?status=queued,in_progress" | \
+ jq ".total_count")
+ echo "Found $count unfinished jobs."
+ echo "::set-output name=count::$count"
+ if [[ $count -lt 20 ]]; then
+ echo "Less than 20 pending workflows runs, skip cancelling..."
+ exit 1
+ fi
+ echo "will cancel duplicates.."
+
+ - uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738
name: "Cancel duplicate workflow runs"
with:
Review comment:
```suggestion
if: steps.check_queued.outputs.count >= 20
with:
```
##########
File path: .github/workflows/cancel_duplicates.yml
##########
@@ -1,25 +1,33 @@
name: Cancel Duplicates
on:
- workflow_run:
- workflows: ["CI"]
- types: ["requested"]
+ # Checks for duplicate jobs on every push (merge) and every 10 minutes
+ push:
+ schedule:
+ - cron: "*/10 * * * *"
jobs:
- cancel-duplicate-workflow-runs:
- name: "Cancel duplicate workflow runs"
- runs-on: ubuntu-latest
+ cancel-duplicate-runs:
+ name: Cancel duplicate workflow runs
+ runs-on: ubuntu-20.04
+ continue-on-error: true
Review comment:
It's better to not error. You can use output and if: conditional in the cancel action
```suggestion
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org