Reputation: 959
I'm trying to learn how to use GitHub Actions and I'm running into a small issue. When I run the code locally, the files created while python training/train.py
is running are created in the correct folder. However, when I try to do the same thing with GitHub Actions, the files are only created when I choose to create them in the root directory rather than /training/outputs/
. Is there a way to resolve this?
Here's my GitHub repository: https://github.com/JayThibs/github-actions-ml-template
Upvotes: 1
Views: 1309
Reputation: 959
I've figured out how to resolve this so I figured I should share here.
Since I am using CML (Continuous Machine Learning), I could simply include the following line in my GitHub Actions cml.yaml file:
cml-pr training/outputs/*
This is because cml does not push outputs to my code automatically.
Besides using cml-pr
, you can also use the following github push manually:
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add training/outputs/*
git commit --message "Commit training outputs"
git push
Please keep in mind that the latter solution won't handle merge conflicts gracefully if there is a race condition between several simultaneous runs.
Since the action will push files to your repository, it will trigger another GitHub Action if your action is triggered on push. To resolve this, simply add something like [skip ci] in your commit message and GitHub will prevent an action to be triggered. You can learn more about it here: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
0x2b3bfa0 on GitHub helped me resolve this issue, you can find our conversation here: https://github.com/iterative/cml/issues/658
Upvotes: 3