From 49e1056c70b38f5e3971ddd044add176f34d0d71 Mon Sep 17 00:00:00 2001 From: rlespinasse Date: Mon, 25 Jan 2021 18:11:45 +0100 Subject: [PATCH] docs(troubleshooting): add naming convention issue --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 4646f81..cbb51dc 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This GitHub Action will expose the slug/short values of [some GitHub environment - [Short variables](#short-variables) - [Contribute](#contribute) - [Troubleshooting](#troubleshooting) + - [One of environement variable don't work as intended](#one-of-environement-variable-dont-work-as-intended) - [An action could not be found at the URI](#an-action-could-not-be-found-at-the-uri) - [Thanks for talking about us](#thanks-for-talking-about-us) @@ -60,30 +61,30 @@ Check for more [examples][3] (OS usage, URL use, ...) ### Slug variables -| Variable | Slug version of | Description | -| ----------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------- | -| [GITHUB_REPOSITORY_SLUG](docs/slug-variables.md#GITHUB_REPOSITORY_SLUG) | GITHUB_REPOSITORY | The owner and repository name. | -| [GITHUB_REF_SLUG](docs/slug-variables.md#GITHUB_REF_SLUG) | GITHUB_REF | The branch or tag ref that triggered the workflow. | -| [GITHUB_HEAD_REF_SLUG](docs/slug-variables.md#GITHUB_HEAD_REF_SLUG) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for forked repositories. | -| [GITHUB_BASE_REF_SLUG](docs/slug-variables.md#GITHUB_BASE_REF_SLUG) | GITHUB_BASE_REF | The branch of the base repository.
Only set for forked repositories. | -| [GITHUB_EVENT_REF_SLUG](docs/slug-variables.md#GITHUB_EVENT_REF_SLUG) | _github.event.ref_ | [Only set for `create`, and `delete` webhook events][4]. | +| Variable | Slug version of | Description | +| ----------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------- | +| [GITHUB_REPOSITORY_SLUG](docs/slug-variables.md#github_repository_slug) | GITHUB_REPOSITORY | The owner and repository name. | +| [GITHUB_REF_SLUG](docs/slug-variables.md#github_ref_slug) | GITHUB_REF | The branch or tag ref that triggered the workflow. | +| [GITHUB_HEAD_REF_SLUG](docs/slug-variables.md#github_head_ref_slug) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for forked repositories. | +| [GITHUB_BASE_REF_SLUG](docs/slug-variables.md#github_base_ref_slug) | GITHUB_BASE_REF | The branch of the base repository.
Only set for forked repositories. | +| [GITHUB_EVENT_REF_SLUG](docs/slug-variables.md#github_event_ref_slug) | _github.event.ref_ |
Only set for [following webhook events][4] | ### Slug URL variables -| Variable | Slug version of | Description | -| ----------------------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------- | -| [GITHUB_REPOSITORY_SLUG_URL](docs/slug-url-variables.md#GITHUB_REPOSITORY_SLUG_URL) | GITHUB_REPOSITORY | The owner and repository name. | -| [GITHUB_REF_SLUG_URL](docs/slug-url-variables.md#GITHUB_REF_SLUG_URL) | GITHUB_REF | The branch or tag ref that triggered the workflow. | -| [GITHUB_HEAD_REF_SLUG_URL](docs/slug-url-variables.md#GITHUB_HEAD_REF_SLUG_URL) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for forked repositories. | -| [GITHUB_BASE_REF_SLUG_URL](docs/slug-url-variables.md#GITHUB_BASE_REF_SLUG_URL) | GITHUB_BASE_REF | The branch of the base repository.
Only set for forked repositories. | -| [GITHUB_EVENT_REF_SLUG_URL](docs/slug-url-variables.md#GITHUB_EVENT_REF_SLUG_URL) | _github.event.ref_ | [Only set for `create`, and `delete` webhook events][4]. | +| Variable | Slug version of | Description | +| ----------------------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------- | +| [GITHUB_REPOSITORY_SLUG_URL](docs/slug-url-variables.md#github_repository_slug_url) | GITHUB_REPOSITORY | The owner and repository name. | +| [GITHUB_REF_SLUG_URL](docs/slug-url-variables.md#github_ref_slug_url) | GITHUB_REF | The branch or tag ref that triggered the workflow. | +| [GITHUB_HEAD_REF_SLUG_URL](docs/slug-url-variables.md#github_head_ref_slug_url) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for forked repositories. | +| [GITHUB_BASE_REF_SLUG_URL](docs/slug-url-variables.md#github_base_ref_slug_url) | GITHUB_BASE_REF | The branch of the base repository.
Only set for forked repositories. | +| [GITHUB_EVENT_REF_SLUG_URL](docs/slug-url-variables.md#github_event_ref_slug_url) | _github.event.ref_ |
Only set for [following webhook events][4] | ### Short variables -| Variable | Short version of | Description | -| ------------------------------------------------------------------------------------------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| [GITHUB_SHA_SHORT](docs/short-variables.md#GITHUB_SHA_SHORT) | GITHUB_SHA | The commit SHA that triggered the workflow. | -| [GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT](docs/short-variables.md#GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT) | _github.event.pull_request.head.sha_ | The commit SHA on pull request that trigger workflow.
[Only set for `pull_request`, `pull_request_review`, `pull_request_review_comment`, and `pull_request_target` webhook events][4]. | +| Variable | Short version of | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [GITHUB_SHA_SHORT](docs/short-variables.md#github_sha_short) | GITHUB_SHA | The commit SHA that triggered the workflow. | +| [GITHUB_EVENT
_PULL_REQUEST
_HEAD_SHA_SHORT](docs/short-variables.md#github_event_pull_request_head_sha_short) | _github.event
.pull_request
.head.sha_ | The commit SHA on pull request that trigger workflow.
Only set for [following webhook events][4] | ## Contribute @@ -91,6 +92,37 @@ Follow [Developers guide](DEVELOPERS.md) ## Troubleshooting +### One of environement variable don't work as intended + +[**Note**][17]: GitHub reserves the `GITHUB_` environment variable prefix for internal use by GitHub. Setting an environment variable or secret with the `GITHUB_` prefix will result in an error. + +Currently, a GitHub workflow setting a `GITHUB_` variable don't ended up in error. +And if a custom `GITHUB_` variable is in conflict with an official `GITHUB_` variable, the offical `GITHUB_` variable will override custom one. + +
+ Test workflow +

+ +```yaml +name: Test +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: echo ${GITHUB_REF} + # print "refs/heads/v3.x" + - run: echo "GITHUB_REF=one_value" >> "$GITHUB_ENV" + - run: echo ${GITHUB_REF} + # print "refs/heads/v3.x" + - run: echo "GITHUB_REF_SLUG=another_value" >> "$GITHUB_ENV" + - run: echo ${GITHUB_REF_SLUG} + # print "another_value" +``` + +

+
+ ### An action could not be found at the URI If your workflow fail on the `Set up job` task with this kind of log :