Skip to content

[Bug] Installer not working correctly when used with Act locally #331

Description

@tomwyr

Describe the bug
When using the action locally with Act, it fails to restore cache after running the action for the second and consecutive times.
The action seems to be mistakenly clearing the cache in the process.

To Reproduce
Steps to reproduce the behavior:

  • Install Act.
  • Setup a workflow that only installs Swift.
  • Run the workflow with act -j setup-swift for the first time - action installs toolchain correctly.
  • Run the workflow second time - action fails to restore cache and find Swift in path.
name: Setup Swift

on:
  push:
    branches:
      - main

jobs:
  setup-swift:
    runs-on: ubuntu-22.04
    steps:
      - uses: SwiftyLab/setup-swift@latest

Expected behavior
Action restores cached Swift toolchain and adds it to path.

Logs
first-run.txt
second-run.txt

Runner (please complete the following information):

  • Name: ubuntu-22.04
  • OS: Ubuntu
  • Version 22.04

Additional context
Based on the logs and looking through the sources, what I noticed is:

  • Action gets Swift location in tool-cache src
  • Action reaches the line where it starts the cache restoration process src
  • Tool-cache prepares the cache installation location by removing existing files at the destination path src
  • Because the source and the target destinations are the same, what effectively happens is tool-cache removes cached files first and tries to copy non-existent files to the same location src

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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