From 30f18d858e6023387f132cf13eba97675c623c2b Mon Sep 17 00:00:00 2001 From: cytopia Date: Sun, 29 Nov 2020 13:38:54 +0100 Subject: [PATCH] Fix SLUG and TYPE for GitHub Actions --- .github/workflows/php-ci.yml | 26 ++++++++++++++++++-------- .github/workflows/php-nightly.yml | 26 ++++++++++++++++++-------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/php-ci.yml b/.github/workflows/php-ci.yml index a32b2a1..6d74e8f 100644 --- a/.github/workflows/php-ci.yml +++ b/.github/workflows/php-ci.yml @@ -93,14 +93,24 @@ jobs: - name: Set variables id: vars run: | - # Detached from branch - if [ "$( git rev-parse --abbrev-ref HEAD )" = "HEAD" ]; then - GIT_TYPE=TAG - GIT_SLUG="$( git tag --points-at HEAD | head -1 )" - else - GIT_TYPE=BRANCH - GIT_SLUG="$( git rev-parse --abbrev-ref HEAD )" - fi + + # Retrieve git info (tags, etc) + git fetch --all + + # BRANCH, TAG or COMMIT + GIT_TYPE="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_TYPE' \ + | sed 's|.*=||g' \ + )" + # Branch name, Tag name or Commit Hash + GIT_SLUG="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_NAME' \ + | sed 's|.*=||g' \ + )" # Output echo "GIT_TYPE=${GIT_TYPE}" diff --git a/.github/workflows/php-nightly.yml b/.github/workflows/php-nightly.yml index 1752d03..43a8519 100644 --- a/.github/workflows/php-nightly.yml +++ b/.github/workflows/php-nightly.yml @@ -97,14 +97,24 @@ jobs: - name: Set variables id: vars run: | - # Detached from branch - if [ "$( git rev-parse --abbrev-ref HEAD )" = "HEAD" ]; then - GIT_TYPE=TAG - GIT_SLUG="$( git tag --points-at HEAD | head -1 )" - else - GIT_TYPE=BRANCH - GIT_SLUG="$( git rev-parse --abbrev-ref HEAD )" - fi + + # Retrieve git info (tags, etc) + git fetch --all + + # BRANCH, TAG or COMMIT + GIT_TYPE="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_TYPE' \ + | sed 's|.*=||g' \ + )" + # Branch name, Tag name or Commit Hash + GIT_SLUG="$( \ + curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \ + | sh \ + | grep '^GIT_NAME' \ + | sed 's|.*=||g' \ + )" # Output echo "GIT_TYPE=${GIT_TYPE}"