slack-ruby / slack-ruby-client

A Ruby and command-line client for the Slack Web, Real Time Messaging and Event APIs.
MIT License
1.21k stars 216 forks source link

Fix: fetch entire depth of commits to avoid detached HEAD. #464

Closed dblock closed 1 year ago

dblock commented 1 year ago

Using actions/checkout@v3 with defaults checks out a detached HEAD at depth: 1. When you try to git submodule foreach git pull origin master it will cause a conflict with the detached HEAD.

To reproduce:

mkdir slack-ruby-client
cd slack-ruby-client/
git init
git remote add origin https://github.com/slack-ruby/slack-ruby-client
git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +58c0f41060d1a32ec64d84a43da5c9e1547b7252:refs/remotes/origin/master
git checkout --force -B master refs/remotes/origin/master
git submodule sync --recursive
git submodule update --init --force --depth=1 --recursive # the problem is here
git submodule foreach git pull origin master

Here's a successful run, https://github.com/dblock/slack-ruby-client/actions/runs/4602617417 and an issue created from the change, https://github.com/dblock/slack-ruby-client/pull/2.

Needs a CHANGELOG update on top.

dangerpr-bot commented 1 year ago
1 Warning
:warning: Unless you're refactoring existing code or improving documentation, please update CHANGELOG.md.

Here's an example of a CHANGELOG.md entry:

* [#464](https://github.com/slack-ruby/slack-ruby-client/pull/464): Fix: fetch entire depth of commits to avoid detached head - [@dblock](https://github.com/dblock).

Generated by :no_entry_sign: Danger

dblock commented 1 year ago

@duffn