nicksnell/action-reset-repo

Cannot use this action more than once

Opened this issue · 0 comments

Symptoms

A single action works perfectly well:

- name: Reset foo branch from main
  uses: nicksnell/action-reset-repo@master
  with:
    base_branch: main
    reset_branch: foo
    github_token: ${{ secrets.GITHUB_TOKEN }}

However if we add another step that uses the same action, we get an error
mkdir: cannot create directory '_tmp': File exists

Cause

Your action needs to create a _tmp checkout folder. Unfortunately upon completion, any created files are not cleaned up. When the action runs again, it finds the previously created folder and fails.

Suggestion

  • Please add a cleanup step in your action to remove the _tmp directory
  • BONUS: update the action to compensate for an existing path, rather than fail