feat: use GITHUB_REF_POINT as variable for the branch name (#149)

BREAKING CHANGE: Change the behavior of GITHUB_REF_NAME to match the default GitHub Action behavior,
BREAKING CHANGE: Introduce GITHUB_REF_POINT as a replacement for GITHUB_REF_NAME to match this GitHub Action behavior in v4.
This commit is contained in:
Romain Lespinasse
2024-11-06 00:10:03 +01:00
parent 63a442f83b
commit aba9f8db6e
9 changed files with 309 additions and 273 deletions

View File

@@ -4,13 +4,14 @@
- [Slug Variables](#slug-variables)
- [Table of Contents](#table-of-contents)
- [GITHUB_REPOSITORY_SLUG](#github_repository_slug)
- [GITHUB_REPOSITORY_OWNER_PART_SLUG](#github_repository_owner_part_slug)
- [GITHUB_REPOSITORY_NAME_PART_SLUG](#github_repository_name_part_slug)
- [GITHUB_REF_SLUG](#github_ref_slug)
- [GITHUB_HEAD_REF_SLUG](#github_head_ref_slug)
- [GITHUB_BASE_REF_SLUG](#github_base_ref_slug)
- [GITHUB_EVENT_REF_SLUG](#github_event_ref_slug)
- [GITHUB\_REPOSITORY\_SLUG](#github_repository_slug)
- [GITHUB\_REPOSITORY\_OWNER\_PART\_SLUG](#github_repository_owner_part_slug)
- [GITHUB\_REPOSITORY\_NAME\_PART\_SLUG](#github_repository_name_part_slug)
- [GITHUB\_REF\_SLUG](#github_ref_slug)
- [GITHUB\_REF\_NAME\_SLUG](#github_ref_name_slug)
- [GITHUB\_HEAD\_REF\_SLUG](#github_head_ref_slug)
- [GITHUB\_BASE\_REF\_SLUG](#github_base_ref_slug)
- [GITHUB\_EVENT\_REF\_SLUG](#github_event_ref_slug)
## GITHUB_REPOSITORY_SLUG
@@ -18,10 +19,10 @@ Slug the environment variable **GITHUB_REPOSITORY**
The owner and repository name.
| GITHUB_REPOSITORY | GITHUB_REPOSITORY_SLUG |
| ---------------------------- | ---------------------------- |
| octocat/Hello-World | octocat-hello-world |
| rlespinasse/Hello-World.go | rlespinasse-hello-world.go |
| GITHUB_REPOSITORY | GITHUB_REPOSITORY_SLUG |
| ----------------- | ---------------------- |
| octocat/Hello-World | octocat-hello-world |
| rlespinasse/Hello-World.go | rlespinasse-hello-world.go |
| AnotherPerson/SomeRepository | anotherperson-somerepository |
## GITHUB_REPOSITORY_OWNER_PART_SLUG
@@ -32,9 +33,9 @@ The Owner part of **GITHUB_REPOSITORY** variable.
| GITHUB_REPOSITORY_OWNER_PART | GITHUB_REPOSITORY_OWNER_PART_SLUG |
| ---------------------------- | --------------------------------- |
| octocat | octocat |
| rlespinasse | rlespinasse |
| AnotherPerson | anotherperson |
| octocat | octocat |
| rlespinasse | rlespinasse |
| AnotherPerson | anotherperson |
## GITHUB_REPOSITORY_NAME_PART_SLUG
@@ -44,9 +45,9 @@ The Repository name part of **GITHUB_REPOSITORY** variable.
| GITHUB_REPOSITORY_NAME_PART | GITHUB_REPOSITORY_NAME_PART_SLUG |
| --------------------------- | -------------------------------- |
| Hello-World | hello-world |
| Hello-World.go | hello-world.go |
| SomeRepository | somerepository |
| Hello-World | hello-world |
| Hello-World.go | hello-world.go |
| SomeRepository | somerepository |
## GITHUB_REF_SLUG
@@ -55,14 +56,30 @@ Slug the environment variable **GITHUB_REF**
The branch or tag ref that triggered the workflow.
_If neither a branch or tag is available for the event type, the variable will not exist._
| GITHUB_REF | GITHUB_REF_SLUG |
| ------------------------------ | ------------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/tags/v1.0.0 | v1.0.0 |
| refs/tags/product@1.0.0-rc.2 | product-1.0.0-rc.2 |
| GITHUB_REF | GITHUB_REF_SLUG |
| ---------- | --------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/tags/v1.0.0 | v1.0.0 |
| refs/tags/product@1.0.0-rc.2 | product-1.0.0-rc.2 |
| refs/heads/New_Awesome_Product | new-awesome-product |
## GITHUB_REF_NAME_SLUG
Slug the environment variable **GITHUB_REF_NAME**
The branch or tag ref that triggered the workflow.
_If neither a branch or tag is available for the event type, the variable will not exist._
| GITHUB_REF_NAME | GITHUB_REF_SLUG |
| --------------- | --------------- |
| main | main |
| feat/new_feature | feat-new-feature |
| v1.0.0 | v1.0.0 |
| product@1.0.0-rc.2 | product-1.0.0-rc.2 |
| New_Awesome_Product | new-awesome-product |
| 42/merge | 42-merge |
## GITHUB_HEAD_REF_SLUG
Slug the environment variable **GITHUB_HEAD_REF**
@@ -70,11 +87,11 @@ Slug the environment variable **GITHUB_HEAD_REF**
The branch of the head repository.
_Only set for [`pull-request`][1] event and forked repositories._
| GITHUB_REF | GITHUB_HEAD_REF_SLUG |
| ------------------------------ | -------------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/heads/New_Awesome_Product | new-awesome-product |
| GITHUB_REF | GITHUB_HEAD_REF_SLUG |
| ---------- | -------------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/heads/New_Awesome_Product | new-awesome-product |
## GITHUB_BASE_REF_SLUG
@@ -83,23 +100,23 @@ Slug the environment variable **GITHUB_BASE_REF**
The branch of the base repository.
_Only set for [`pull-request`][1] event and forked repositories._
| GITHUB_REF | GITHUB_HEAD_REF_SLUG |
| ------------------------------ | -------------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/heads/New_Awesome_Product | new-awesome-product |
| GITHUB_REF | GITHUB_HEAD_REF_SLUG |
| ---------- | -------------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/heads/New_Awesome_Product | new-awesome-product |
## GITHUB_EVENT_REF_SLUG
Slug the variable **github.event.ref**
The git reference resource associated to triggered webhook.
The Git reference resource associated to triggered webhook.
_Only set for [`create`, and `delete`][1] events._
| GITHUB_REF | GITHUB_HEAD_REF_SLUG |
| ------------------------------ | -------------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/heads/New_Awesome_Product | new-awesome-product |
| GITHUB_REF | GITHUB_HEAD_REF_SLUG |
| ---------- | -------------------- |
| refs/heads/main | main |
| refs/heads/feat/new_feature | feat-new-feature |
| refs/heads/New_Awesome_Product | new-awesome-product |
[1]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads