Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Workflow from tar_github_actions() fails if there is no targets-runs branch #815

@tarensanders

Description

@tarensanders

Prework

  • [x ] Read and agree to the code of conduct and contributing guidelines.
  • [ x] Confirm that your issue is a genuine bug in the targets package itself and not a user error, known limitation, or issue from another package that targets depends on. For example, if you get errors running tar_make_clustermq(), try isolating the problem in a reproducible example that runs clustermq and not targets. And for miscellaneous troubleshooting, please post to discussions instead of issues.
  • [ x] If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
  • Using targets::tar_reprex(), reprex::reprex(), or similar, post a minimal reproducible example like this one so the maintainer can troubleshoot the problems you identify. A reproducible example is:
    • Runnable: post enough R code and data so any onlooker can create the error on their own computer.
    • Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
    • Readable: format your code according to the tidyverse style guide.

Description

In trying to use the workflow created by tar_github_actions(), I'm running into the following error:

Run git config --local user.name "GitHub Actions"
  git config --local user.name "GitHub Actions"
  git config --local user.email "[email protected]"
  rm -r .gitignore .github/workflows
  git add --all -- ':!renv'
  for file in $(git ls-files -mo --exclude=renv)
  do
    git add $file
  done
  git commit -am "Run pipeline"
  git push origin targets-runs
  shell: sh -e {0}
  env:
    GITHUB_PAT: ***
    RENV_PATHS_ROOT: ~/.local/share/renv
    INCITES_KEY: ***
    LANG: en_US.UTF-[8](https://github.com/tarensanders/cv/runs/5746071805?check_suite_focus=true#step:13:8)
The following paths are ignored by one of your .gitignore files:
_targets/meta/process
Use -f if you really want to add them.
Error: Process completed with exit code 1.

In lieu of a reprex, I forked the targets-minimal repo (fork is here). The workflow ran fine the first time. But once I removed the existing targets-runs branch (i.e., to make it the same as a new project), the workflow fails with the same error I am getting. You can see the failed workflow here.

I think the issue is that one or more of the files trying to be committed is listed in the .gitignore within the _targets folder. Changing the line git add $file to git add $file -f (as suggested by the error message) fixes the issue, but I don't know enough about git to know if that's a reasonable solution.

EDIT: Just noting that I don't think git add $file -f is the right solution. It commits the meta/process and meta/progress files everytime, which seems excessive. Maybe additional files need to be passed to exclude?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions