Urgent.News

What's breaking now, across thousands of outlets.

Tech

Reducing Duplicate CI Runs with GitHub Actions Concurrency `cancel-in-progress`

Reducing Duplicate CI Runs with GitHub Actions Concurrency cancel-in-progress TL;DR: I added a concurrency block with cancel-in-progress: true to the ci-e2e.yml workflow to automatically abort older runs on the same branch when a new push arrives. This change cuts down on wasted minutes and prevents flaky test artifacts caused by overlapping executions. The Problem Our tvview project runs an…

Duplicate CI runs can waste valuable minutes and lead to flaky test results when GitHub Actions queues multiple workflow executions for the same branch. In a TV view project that runs an end-to-end test suite on every push and a scheduled cron job, this issue became apparent when developers pushed multiple commits in quick succession.

GitHub Actions would queue a new workflow run for each commit, resulting in duplicate work that was eventually superseded by the latest commit. This caused wasted CI minutes and potential race conditions due to overlapping executions.

The reporter initially tried to mitigate the issue by adding a manual "skip if already running" step at the beginning of the job using the GitHub CLI (gh). While this approach worked locally, it introduced race conditions and extra API calls that consumed rate-limited requests. The script also added unnecessary complexity, prompting the reporter to look for a built-in solution.

GitHub Actions introduced a concurrency feature that allows grouping runs by a key and optionally cancelling older runs when a new one starts. By adding a concurrency block with cancel-in-progress: true to the ci-e2e.yml workflow, the reporter was able to automatically abort older runs on the same branch when a new push arrived. This single-line change resolved the issue without adding any custom scripting.

To decide on an appropriate concurrency key, the reporter chose ${{ github.ref }} because it resolves to the full Git ref (e.g., `refs/heads/main` or `refs/pull/12/merge`). This ensures that only runs on the same branch or pull request share a group and can be cancelled accordingly. The updated workflow file included the concurrency block at the top level, which applied to all jobs within the workflow, automatically propagating the cancellation behavior.

After implementing the concurrency feature, the reporter measured the savings over a week and found that total CI minutes decreased from 560 to 210, duplicate runs dropped from 12 to 0, and the cost reduction amounted to approximately $3.50. While the reduction may seem modest, it represents a meaningful improvement for a project that runs heavy end-to-end tests.

The reporter also suggested a potential next step: adding a matrix strategy to run the same E2E suite against multiple Node versions in parallel while still keeping the concurrency guard at the workflow level. This would allow for broader compatibility coverage without reintroducing duplicate runs.

In summary, by leveraging GitHub Actions' concurrency feature with cancel-in-progress: true, the reporter successfully reduced duplicate CI runs, improved efficiency, and prevented flaky test artifacts caused by overlapping executions.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

OverTheWire Bandit Level 2 Writeup — Read a Filename With Spaces

The password file is named spaces in this filename . The shell splits unquoted arguments on whitespace, so the filename has to be quoted or escaped to be treated as one argument.

  • File named "spaces in this filename" has spaces in its name
  • Shell splits filename into separate arguments without quoting
  • Quote or escape spaces to read file contents successfully

Automatic Permit Expiration Alerts & AI Error Reporting in VS (NestJS + Next.js)

Automatic Permit Expiration Alerts & AI Error Reporting in VS (NestJS + Next.js) TL;DR: I added a new priority‑actions endpoint that flags construction permits expiring in ≤30 days, wired it to the…

  • New "Priority‑Actions" endpoint alerts permits expiring in 30 days.
  • Integrated AI error reporting via Sentry for Groq LLM service stability.
  • CI pipeline updated with Husky and Pre‑push hooks to enforce code quality.

Hash Indexes: What they are and their limitations

Hash indexes are a type of database index used to speed up lookups by key. They are commonly implemented using a hash table, which uses hash function to map keys to locations where their corresponding…

  • Hash indexes speed up lookups by key using hash functions and tables.
  • They maintain hash tables in memory for fast access but can be memory-intensive.
  • Hash indexes lack efficient range query support and require WAL for crash recovery.

More from Friday 2 October →