I've been working on Actions CI that leverages both actions/checkout and Jest for tests.
I am specifically using Jest's changedSince flag, which compares the current branch with the passed branch and limits the tests it is running to only those that are associated with the files changed. This is particularly useful for only running the relevant tests when compared against master in a PR.
It would significantly reduce the necessary work for users if there was a way to include multiple branches in the run through a simple YAML property. At present, I need to do this:
steps:
- uses: actions/checkout@v2
- run: |
git fetch --no-tags --depth=1 origin master
git checkout -b master
git checkout ${{ github.event.pull_request.head.sha }}
something like the following would be amazingly useful, where checkout is an array of branches to checkout on every run _while still keeping the PR's branch as the currently checked out branch_:
steps:
- uses: actions/checkout@v2
checkout: ['master']
checkout may not be the most appropriate name, but the idea is more of what I'm going for here 鉂わ笍
Thanks for the tip on checking out multiple refs, that's going to help me out!
My use case is similar - running linting tools only on the files that have changed using pre-commit. To do this, I use the following command:
pre-commit run --show-diff-on-failure --source origin/master --origin HEAD
But this isn't possible without specific run commands as @bnb has shown above.
i think this proposal would fix: https://github.com/actions/checkout/pull/155
Is there any way around this issue in checkout@v2? With checkout@v1 we were able to make use of the origin/master ref, but mysteriously it is no longer available in v2. I need v2 due to this, but also need access origin/master for use with Jest's --changedSince. Has anyone found a workaround?
Most helpful comment
Thanks for the tip on checking out multiple refs, that's going to help me out!
My use case is similar - running linting tools only on the files that have changed using pre-commit. To do this, I use the following command:
pre-commit run --show-diff-on-failure --source origin/master --origin HEADBut this isn't possible without specific run commands as @bnb has shown above.