actions / checkout

Action for checking out a repo

Home Page:https://github.com/features/actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Checkout fails with exit code 1

yashodgayashan opened this issue · comments

Context

We are using the checkout action v3 and we are checking out the repository with a token which was generated using installation. Sample code snippet can be found below.

- name: Checkout Source Code
  uses: actions/checkout@v3
  with:
    repository: org/repo
    token: ${{ secrets.APP_GH_TOKEN }}
    ref: ${{ github.event.inputs.sha }}

Error

We have experienced the following error without any additional details.

2024-05-06T04:58:15.2481291Z ##[endgroup]
2024-05-06T04:58:15.2481737Z ##[group]Fetching the repository
2024-05-06T04:58:15.2482836Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/N/A*:refs/remotes/origin/N/A* +refs/tags/N/A*:refs/tags/N/A*
2024-05-06T04:58:15.3984351Z The process '/usr/bin/git' failed with exit code 1
2024-05-06T04:58:15.3984913Z Waiting 15 seconds before trying again
2024-05-06T04:58:30.4053221Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/N/A*:refs/remotes/origin/N/A* +refs/tags/N/A*:refs/tags/N/A*
2024-05-06T04:58:31.1039500Z The process '/usr/bin/git' failed with exit code 1
2024-05-06T04:58:31.1040119Z Waiting 15 seconds before trying again
2024-05-06T04:58:46.1100718Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/N/A*:refs/remotes/origin/N/A* +refs/tags/N/A*:refs/tags/N/A*
2024-05-06T04:58:47.8410144Z ##[error]The process '/usr/bin/git' failed with exit code 1
2024-05-06T04:58:47.8559716Z ##[group]Run actions/checkout@v3

What event are you using to trigger this workflow?

It looks like github.event.inputs.sha resolves to N/A. Is that a tag or branch you are expecting in your repository?

There are a few issues and pull requests open with regards to improving the logging. I'm looking to get around to them soon so that this would give a clearer error.

I'm going to close this out. Unless you are using a workflow_dispatch with a sha supplied, I would not expect your checkout call to work.

Take a look at the GitHub context (https://docs.github.com/en/actions/learn-github-actions/contexts#github-context) or the specific event payload (https://docs.github.com/en/webhooks/webhook-events-and-payloads) to know what fields to expect.

@cory-miller We have investigated the issue and seems due to some internal bug the sha has been replaced with empty string. Thank you for the help. Really appreciate it.