Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 12, 2025

Replace always() with !cancelled() in GitHub Actions workflows to prevent jobs from running when builds are manually cancelled.

Plan:

  • Analyze repository and identify all always() usage in GitHub workflow files
  • Replace always() with !cancelled() in 02-e2e-regenerate.yml (4 instances)
  • Replace always() with !cancelled() in release.yml (1 instance)
  • Replace always() with !cancelled() in default.yml (5 instances)
  • Verify all changes are correct and consistent
  • Test workflow syntax is valid (lint workflow files if possible)

Files modified:

  • .github/workflows/02-e2e-regenerate.yml - 4 upload artifact steps
  • .github/workflows/release.yml - 1 checks-done job
  • .github/workflows/default.yml - 3 regenerate-snapshots jobs, 1 multiline condition, 1 checks-done job

Changes made:

  • Replaced 10 instances of always() with !cancelled() across 3 workflow files
  • Used proper ${{ !cancelled() && condition }} syntax for GitHub expressions
  • Validated YAML syntax with yamllint - all files pass validation
  • All instances now follow the pattern established in PR fix: preview branches not being deployed anymore #4672

Rationale:
Using !cancelled() instead of always() ensures jobs don't run when builds are manually cancelled, while still running when previous steps fail. This improves the user experience by respecting manual cancellations.

Fixes #4673.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link

changeset-bot bot commented Sep 12, 2025

⚠️ No Changeset found

Latest commit: 07236ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Co-authored-by: mfranzke <787658+mfranzke@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces all instances of always() with !cancelled() in GitHub Actions workflows to prevent jobs from running when builds are manually cancelled while still allowing them to run when previous steps fail.

Key changes:

  • Updated conditional logic in workflow files to use !cancelled() instead of always()
  • Applied consistent GitHub expression syntax with ${{ }} wrappers
  • Maintained existing functionality for failure handling while respecting manual cancellations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
.github/workflows/release.yml Updated checks-done job condition to use !cancelled()
.github/workflows/default.yml Updated 5 job conditions including regenerate-snapshots jobs and checks-done
.github/workflows/02-e2e-regenerate.yml Updated 4 upload artifact step conditions to use !cancelled()

@mfranzke mfranzke moved this to 🏗 In development in UX Engineering Team Backlog Sep 12, 2025
@github-actions github-actions bot added the 🚢📀cicd Changes inside .github folder label Sep 12, 2025
@mfranzke mfranzke changed the title [WIP] GitHub Actions: Evaluate to replace always() by '!cancelled()' GitHub Actions: Evaluate to replace always() by '!cancelled()' Sep 12, 2025
mfranzke added a commit that referenced this pull request Sep 15, 2025
As a follow-up to #4895, we need to add a necessary [`!cancelled()`](#4963)
mfranzke added a commit that referenced this pull request Sep 16, 2025
* fix(ci/cd): added missing `!cancelled()` to condition

As a follow-up to #4895, we need to add a necessary [`!cancelled()`](#4963)

* fix: syntax error

* refactor: restructured
@michaelmkraus
Copy link
Contributor

I am not sure if we can simply replace always() with !cancelled().

  • always() ensures that the job still runs even if one of its needs failed. That is exactly what we want for regenerate-snapshots (has to run when tests fail).
  • !cancelled() makes sure the job does not run if the workflow was cancelled (manually).

If we combine both

always() && !cancelled() &&...

it ensures that the job runs on failure (e.g. snapshots are regenerated), but skips on manual cancellation.

@mfranzke
Copy link
Collaborator

mfranzke commented Sep 17, 2025

I am not sure if we can simply replace always() with !cancelled().

  • always() ensures that the job still runs even if one of its needs failed. That is exactly what we want for regenerate-snapshots (has to run when tests fail).
  • !cancelled() makes sure the job does not run if the workflow was cancelled (manually).

If we combine both

always() && !cancelled() &&...

it ensures that the job runs on failure (e.g. snapshots are regenerated), but skips on manual cancellation.

@michaelmkraus My understanding is that cancelled() is equivalent to always(), except that it does not run on cancellation. I've added a screenshot with changes with commit 92bd8c9 to this PR. I want to see if it gets regenerated and committed even though the other three jobs that would cause regeneration are canceled.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mfranzke
Copy link
Collaborator

I am not sure if we can simply replace always() with !cancelled().

  • always() ensures that the job still runs even if one of its needs failed. That is exactly what we want for regenerate-snapshots (has to run when tests fail).
  • !cancelled() makes sure the job does not run if the workflow was cancelled (manually).

If we combine both
always() && !cancelled() &&...
it ensures that the job runs on failure (e.g. snapshots are regenerated), but skips on manual cancellation.

@michaelmkraus My understanding is that cancelled() is equivalent to always(), except that it does not run on cancellation. I've added a screenshot with changes with commit 92bd8c9 to this PR. I want to see if it gets regenerated and committed even though the other three jobs that would cause regeneration are canceled.

@michaelmkraus looks good to me in running https://github.com/db-ux-design-system/core-web/pull/4963/checks?sha=92bd8c9814c3735b3dba647f07f90a687c96e2f4

Does this answer your question ?

@mfranzke mfranzke moved this from 🏗 In development to 👀 In review in UX Engineering Team Backlog Sep 17, 2025
@mfranzke mfranzke merged commit 09c978b into main Sep 18, 2025
55 checks passed
@mfranzke mfranzke deleted the copilot/fix-4673 branch September 18, 2025 17:09
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in UX Engineering Team Backlog Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚢📀cicd Changes inside .github folder 🍄🆙improvement New feature or request

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

GitHub Actions: Evaluate to replace always() by '!cancelled()'

3 participants