Local reusable workflows don't seem to work #80

Closed
opened 2023-03-26 09:27:14 +00:00 by gjabell · 1 comment

The following workflow fails on my personal instance:

.github/workflows/main.yaml

name: Main

on: [push]

jobs:
  build:
    uses: ./.github/workflows/build.yaml
    with:
      package: gitea

.github/workflows/build.yaml

name: Build

on:
  workflow_call:
    inputs:
      package:
        required: true

jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
      - run: echo ${{ inputs.package }}

The logs for the build job:

default(version:main) received task 76 of job 70, be triggered by event: push
workflow prepared
evaluating expression 'success()'
expression 'success()' evaluated to 'true'

stat /galen/images/.github/workflows/build.yaml: no such file or directory

I'm guessing the repository isn't cloned by default so it can't fetch the workflow from the filesystem. I also tried changing the outer workflow to this:

name: Main

on: [push]

jobs:
  checkout:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3

  build:
    needs: checkout
    uses: ./.github/workflows/build.yaml
    with:
      package: gitea

To force a clone, but the reusable job doesn't seem to respect the dependency.

It seems like one option might be to treat all reusable actions as remote, as act seems to clone repos automatically in that case: https://gitea.com/gitea/act/src/branch/main/pkg/runner/reusable_workflow.go#L33

But looking further in that file it looks like it will at least need some tweaking as it only validates / downloads reusable actions that are on github: https://gitea.com/gitea/act/src/branch/main/pkg/runner/reusable_workflow.go#L127

The following workflow fails on my personal instance: `.github/workflows/main.yaml` ```yaml name: Main on: [push] jobs: build: uses: ./.github/workflows/build.yaml with: package: gitea ``` `.github/workflows/build.yaml` ```yaml name: Build on: workflow_call: inputs: package: required: true jobs: build: runs-on: ubuntu-22.04 steps: - run: echo ${{ inputs.package }} ``` The logs for the `build` job: ```bash default(version:main) received task 76 of job 70, be triggered by event: push workflow prepared evaluating expression 'success()' expression 'success()' evaluated to 'true' stat /galen/images/.github/workflows/build.yaml: no such file or directory ``` I'm guessing the repository isn't cloned by default so it can't fetch the workflow from the filesystem. I also tried changing the outer workflow to this: ```yaml name: Main on: [push] jobs: checkout: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 build: needs: checkout uses: ./.github/workflows/build.yaml with: package: gitea ``` To force a clone, but the reusable job doesn't seem to respect the dependency. It seems like one option might be to treat all reusable actions as remote, as `act` seems to clone repos automatically in that case: https://gitea.com/gitea/act/src/branch/main/pkg/runner/reusable_workflow.go#L33 But looking further in that file it looks like it will at least need some tweaking as it only validates / downloads reusable actions that are on github: https://gitea.com/gitea/act/src/branch/main/pkg/runner/reusable_workflow.go#L127
wolfogre added the
kind
bug
label 2023-03-27 01:44:17 +00:00
Member

Now act clone repos only if the reusable workflow is remote. We need to improve the logic to support cloning repos for local reusable workflows.

https://gitea.com/gitea/act/src/branch/main/pkg/runner/reusable_workflow.go#L18

Now `act` clone repos only if the reusable workflow is remote. We need to improve the logic to support cloning repos for local reusable workflows. https://gitea.com/gitea/act/src/branch/main/pkg/runner/reusable_workflow.go#L18
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/act_runner#80
No description provided.