Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions: Job with an "if: always()" are skipped #27906

Closed
sleeperss opened this issue Nov 5, 2023 · 3 comments · Fixed by #29464
Closed

Actions: Job with an "if: always()" are skipped #27906

sleeperss opened this issue Nov 5, 2023 · 3 comments · Fixed by #29464
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Milestone

Comments

@sleeperss
Copy link

sleeperss commented Nov 5, 2023

Description

Jobs with an if: always() statement that depends on a skipped one are also skipped.

on: 
  push:
    branches:
      - master

jobs:
  job1:
    name: Skipped job
    if: false
    steps:
      - run: echo "I am skipped"

  job2:
    name: Mustn't be skipped
    needs: job1
    if: always()
    steps:
      - run: echo "I should have been displayed :'("

image

This makes intermediate optional job impossible

Gitea Version

1.21.0+rc2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

ubuntu

How are you running Gitea?

container from docker hub on linux

Database

SQLite

@lunny lunny added the topic/gitea-actions related to the actions of Gitea label Nov 5, 2023
@KN4CK3R
Copy link
Member

KN4CK3R commented Nov 5, 2023

Does Github support this?

@Zettat123
Copy link
Contributor

Zettat123 commented Feb 27, 2024

According to GitHub's documentation, always() should cause the step to always execute

Causes the step to always execute, and returns true, even when canceled.

There is an example from Example: Not requiring successful dependent jobs

jobs:
  job1:
  job2:
    needs: job1
  job3:
    if: ${{ always() }}
    needs: [job1, job2]

silverwind pushed a commit that referenced this issue Feb 28, 2024
Fix #27906

According to GitHub's
[documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds),
a job should always run when its `if` is `always()`

> If you would like a job to run even if a job it is dependent on did
not succeed, use the `always()` conditional expression in
`jobs.<job_id>.if`.

---------

Co-authored-by: Giteabot <[email protected]>
GiteaBot added a commit to GiteaBot/gitea that referenced this issue Feb 28, 2024
Fix go-gitea#27906

According to GitHub's
[documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds),
a job should always run when its `if` is `always()`

> If you would like a job to run even if a job it is dependent on did
not succeed, use the `always()` conditional expression in
`jobs.<job_id>.if`.

---------

Co-authored-by: Giteabot <[email protected]>
silverwind pushed a commit that referenced this issue Feb 28, 2024
Backport #29464 by @Zettat123

Fix #27906

According to GitHub's
[documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds),
a job should always run when its `if` is `always()`

> If you would like a job to run even if a job it is dependent on did
not succeed, use the `always()` conditional expression in
`jobs.<job_id>.if`.

Co-authored-by: Zettat123 <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2024
@lunny lunny added this to the 1.21.8 milestone Mar 14, 2024
project-mirrors-bot-tu bot pushed a commit to project-mirrors/forgejo-as-gitea-fork that referenced this issue Jan 23, 2025
…o-gitea#29469)

Backport go-gitea#29464 by @Zettat123

Fix go-gitea#27906

According to GitHub's
[documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds),
a job should always run when its `if` is `always()`

> If you would like a job to run even if a job it is dependent on did
not succeed, use the `always()` conditional expression in
`jobs.<job_id>.if`.

Co-authored-by: Zettat123 <[email protected]>
(cherry picked from commit eabcfd3)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants