Skip to content

Potential actions bugs in Gitea 1.27.0 #38466

Description

@william-stacken

Gitea Version

1.27.0

What happened?

I have a minimal test repo with the following two workflows

.gitea/workflows/ci.yaml:

name: Test Pipeline

.targets_list: &targets
  - target: linux
  - target: windows
  - target: macos

on:
  pull_request:

jobs:
  detect-changes:
    runs-on: ubuntu-latest
    outputs:
      targets: ${{ steps.detect.outputs.targets }}
    steps:
      - name: Detect affected targets
        id: detect
        run: |
          targets='["linux","windows"]'
          echo "Affected targets: $targets"
          echo "targets=$targets" >> "$GITHUB_OUTPUT"

  build:
    runs-on: ubuntu-latest
    if: ${{ contains(fromJSON('["linux","windows"]'), matrix.target) }}
    strategy:
      fail-fast: false
      matrix:
        include: *targets
    steps:
      - run: |
          echo "${{ matrix.target }}"

  build-call:
    runs-on: ubuntu-latest
    if: ${{ contains(fromJSON('["linux","windows"]'), matrix.target) }}
    strategy:
      fail-fast: false
      matrix:
        include: *targets
    uses: ./.gitea/workflows/build.yaml
    with:
      target: ${{ matrix.target }}
      artifacts: ${{ true }}

  build-needs:
    runs-on: ubuntu-latest
    needs: [detect-changes]
    if: ${{ contains(fromJSON('["linux","windows"]'), matrix.target) }}
    strategy:
      fail-fast: false
      matrix:
        include: *targets
    steps:
      - run: |
          echo "${{ needs.detect-changes.outputs.targets }}"
          echo "${{ matrix.target }}"

.gitea/workflows/build.yaml:

name: Build

on:
  workflow_call:
    inputs:
      target:
        required: true
        description: The target to build
        type: string
      artifacts:
        required: false
        description: Whether to upload built files as artifacts
        type: boolean
        default: true

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Build
        run: |
          echo "Built ${{ inputs.target }}" > my-build
          echo "Generate artifacts: ${{ inputs.artifacts }}"

      - name: Upload Artifacts
        if: ${{ inputs.artifacts }}
        uses: https://gitea.com/actions/upload-artifact@v3
        with:
          name: build-artifacts
          path: |
            my-build
          if-no-files-found: error

I am encountering these bugs:

  • Even though I pass ${{ true }} to the artifacts input, it is always false when printed out in build.yaml. The target input gets passed as expected, maybe because it is type: string?.
  • All build-needs matrix jobs get skipped, even though it uses the same if: as build where only the macos job gets skipped as expected. The only notable difference is that it depends on detect-changes.
  • No build-call matrix jobs get skipped, even though it uses the same if: as build. The only notable difference is that it calls a reusable workflow.
  • Minor UI bug, the build-call matrix jobs do not get grouped together in the same way that the build-needs jobs do, presumably because of build-call invoking a reusable workflow.
Image

How are you running Gitea?

Docker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions