Skip to content

Commit 7976662

Browse files
authored
docs: improve warning on short auto sizing (#154)
1 parent 56d1321 commit 7976662

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This GitHub Action will expose the slug/short values of [some GitHub environment
1616

1717
- `SLUG_URL` on a variable to have a `slug` variable compliant to be used in a URL
1818
- Like `SLUG` but `.`, and `_` are also replaced by `-`
19-
- `SHORT` on a variable will limit the string size to ~8 characters
19+
- `SHORT` on a variable will limit the string size to [~8 characters](#with-another-length-for-short-values)
2020
- Useful for _sha_ value
2121
- `<KEY>_PART` on a variable will give a part of a variable defined by a key
2222
- Like `GITHUB_REPOSITORY_OWNER_PART` for the owner part of `GITHUB_REPOSITORY`
@@ -68,11 +68,19 @@ steps:
6868
- name: Inject enhanced GitHub environment variables
6969
uses: rlespinasse/github-slug-action@v5
7070
with:
71-
short-length: 7 # By default it's up to Git to decide, use 8 to have the v3.x behavior
71+
short-length: 7 # By default it's up to Git to decide, use 8 to have the v3.x behaviour
7272
```
7373

74+
The length of a short sha depends of the size of **your repository** and can differ over time :
75+
76+
- set `7` to keep the `small repository` behaviour,
77+
- set `8` to reproduce `v3` behaviour,
78+
- set `4` as the minimum length possible.
79+
7480
> [!WARNING]
75-
> If you leave it empty, you need to checkout the source first in order to let Git decide the size by itself.
81+
> If you leave it empty, you need to checkout the source first in order to let Git decide the size by itself by using [`git rev-parse`][git-revparse] behaviour.
82+
>
83+
> The default is the effective value of the [core.abbrev][git-core-abbrev] configuration variable.
7684

7785
## Available Environment variables
7886

@@ -146,12 +154,12 @@ Same as slug variables but URL-compliant
146154
The **GITHUB_REF_NAME SLUG/SLUG_URL** variables doesn't work the same way as before
147155

148156
> [!TIP]
149-
> If you use `v5` or related versions, you need to use `GITHUB_REF_POINT` instead of `GITHUB_REF_NAME` to get the behavior of the `v4` action.
157+
> If you use `v5` or related versions, you need to use `GITHUB_REF_POINT` instead of `GITHUB_REF_NAME` to get the behaviour of the `v4` action.
150158

151-
Before `v5`, the behavior was the same as the GitHub one except on `pull_request*` workflows ([Ready the full story][issue-104]).
159+
Before `v5`, the behaviour was the same as the GitHub one except on `pull_request*` workflows ([Ready the full story][issue-104]).
152160

153-
- `${{ env.GITHUB_REF_NAME }}` will serve the behavior of this action,
154-
- `$GITHUB_REF_NAME` will serve the behavior of GitHub Action.
161+
- `${{ env.GITHUB_REF_NAME }}` will serve the behaviour of this action,
162+
- `$GITHUB_REF_NAME` will serve the behaviour of GitHub Action.
155163

156164
On `pull_request*` workflows, the content will be `<PR-number>/merge` instead of the branch name.
157165
So you need to use `GITHUB_REF_POINT` instead
@@ -166,23 +174,23 @@ steps:
166174
167175
```
168176

169-
Then `${{ env.GITHUB_REF_POINT }}`, and `$GITHUB_REF_POINT` will serve the behavior of this action.
170-
And `${{ env.GITHUB_REF_NAME }}`, and `$GITHUB_REF_NAME` will serve the behavior of GitHub Action.
177+
Then `${{ env.GITHUB_REF_POINT }}`, and `$GITHUB_REF_POINT` will serve the behaviour of this action.
178+
And `${{ env.GITHUB_REF_NAME }}`, and `$GITHUB_REF_NAME` will serve the behaviour of GitHub Action.
171179

172180
### v3 to v4
173181

174182
Since `v4`, it's Git who manage the short variables by using [`git rev-parse`][git-revparse] behaviour.
175-
The length of a short sha depends of the size of our repository and can differ over time.
183+
The length of a short sha depends of the size of **your repository** and can differ over time.
176184

177185
To manage that moving length, you can use `short-length` input
178186

179-
- set `7` to reproduce `small repository` behavior
180-
- set `8` to reproduce `v3` behavior
187+
- set `7` to reproduce `small repository` behaviour
188+
- set `8` to reproduce `v3` behaviour
181189

182190
> [!WARNING]
183191
> The minimum length is 4, the default is the effective value of the [core.abbrev][git-core-abbrev] configuration variable.
184192

185-
So to reproduce previous behavior, use
193+
So to reproduce previous behaviour, use
186194

187195
```yaml
188196
steps:
@@ -199,14 +207,14 @@ steps:
199207
> [!WARNING]
200208
> When you set a custom environment variable, you [cannot use any of the default environment variable names][naming-conventions]. For a complete list of these, see [Default environment variables][default-environment-variables]. **If you attempt to override the value of one of these default environment variables, the assignment is ignored.**
201209

202-
If a variable start to be used as default environment variable, the environment variable may have a different behavior than the expected one.
210+
If a variable start to be used as default environment variable, the environment variable may have a different behaviour than the expected one.
203211

204212
If this append, the `${{ env.GITHUB_AWESOME_VARIABLE }}` and `$GITHUB_AWESOME_VARIABLE` expression will not works in the same way.
205213

206-
- `${{ env.GITHUB_AWESOME_VARIABLE }}` will serve the behavior of this action,
207-
- `$GITHUB_AWESOME_VARIABLE` will serve the behavior of GitHub Action.
214+
- `${{ env.GITHUB_AWESOME_VARIABLE }}` will serve the behaviour of this action,
215+
- `$GITHUB_AWESOME_VARIABLE` will serve the behaviour of GitHub Action.
208216

209-
Otherwise the two expression will serve the behavior of this action.
217+
Otherwise the two expression will serve the behaviour of this action.
210218
This will not occurs if you use the `prefix` input to avoid the issue.
211219

212220
> [!IMPORTANT]

0 commit comments

Comments
 (0)