-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
When using the path
variable to clone a repository into another folder, the repo is not cloned to the correct commit, and git is not set up properly
jobs:
backup:
runs-on: [self-hosted]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: folder
ref: ${{ github.sha }}
- name: CD
run: |
cd folder
- name: Log Commit Hash
run: |
echo ${{ github.sha }} && git log -1 --format='%H'
Expected Result:
abcde
abcde
Actual Result:
abcde
defgh
Despite the final debug log from actions/checkout
of git log -1 --format='%H'
producing the correct value, when run in the cloned repository, it shows a different (older) commit hash.
The script does not set up authentication, so git pull origin <branch>
is not possible.
The cloned repository is at a different point in time. git reset --hard HEAD
reverts to that commit and git reset --hard abcde
results in the hash not being known.
Metadata
Metadata
Assignees
Labels
No labels