go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.55k stars 5.44k forks source link

Difference between github and gitea actions when running contains(needs.*.result, 'success') #31007

Open ldomesjo opened 5 months ago

ldomesjo commented 5 months ago

Description

Hello,

I am trying to specify a job which is dependant on two other jobs finishing with an error, but there's seems to be a difference between how this is handled between github actions and gitea actions. I created this example workflow for github, accessible here https://github.com/ldomesjo/testing-github-actions/tree/main/.github/workflows:

name: learn-github-actions
run-name: ${{ github.actor }} is learning GitHub Actions
on: [push]
jobs:
  first-job:
    runs-on: ubuntu-latest
    steps:
      - run: echo meh
  second-job:
    runs-on: ubuntu-latest
    steps:
      - run: echo meh
  third-job:
    runs-on: ubuntu-latest
    needs:
      - first-job
      - second-job
    steps:
      - run: echo '${{ toJSON(needs) }}'
      - run: echo ${{ contains(needs.*.result, 'success') }}

Which outputs this: image

I then created a similar workflow for gitea actions looking like this:

name: learn-gitea-actions
run-name: ${{ gitea.actor }} is learning Gitea Actions
on: [push]
jobs:
  first-job:
    runs-on: action-runner
    steps:
      - run: echo meh
  second-job:
    runs-on: action-runner
    steps:
      - run: echo meh
  third-job:
    runs-on: action-runner
    needs:
      - first-job
      - second-job
    steps:
      - run: echo '${{ toJSON(needs) }}'
      - run: echo ${{ contains(needs.*.result, 'success') }}

Giving this output: image

Gitea Version

1.21.11

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Running the rootless docker version of gitea

Database

None

yp05327 commented 4 months ago

image related code in act