mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-06-10 16:43:09 +00:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
797d688647 | ||
|
|
55f5982579 | ||
|
|
5ee5b39fa5 | ||
|
|
399f2aa780 | ||
|
|
87a6de197b | ||
|
|
6e13412dd5 | ||
|
|
00d4236bb3 | ||
|
|
e5042e702f | ||
|
|
d1ca8ffbce | ||
|
|
094dd7fdb3 | ||
|
|
4bf56f04ea | ||
|
|
552f3c0362 | ||
|
|
102b1a064a | ||
|
|
a362e5fb42 | ||
|
|
b011e83cf8 | ||
|
|
00198f8992 | ||
|
|
9c3571fd3d | ||
|
|
0141d9b38d | ||
|
|
33cd7a701d | ||
|
|
2c5a627861 | ||
|
|
aa95092e35 | ||
|
|
1615fcb48b | ||
|
|
812bd42f94 | ||
|
|
6839855732 | ||
|
|
53459a86e2 | ||
|
|
4177734b38 | ||
|
|
ad808ea8b2 | ||
|
|
7a3b4c1766 | ||
|
|
dbbe21b72b | ||
|
|
88f3ee8f6f | ||
|
|
cd9871b66e | ||
|
|
1fb0eeb01e |
@@ -1,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
27
.github/dependabot.yml
vendored
Normal file
27
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/.github/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
groups:
|
||||||
|
dependencies:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
reviewers:
|
||||||
|
- "rlespinasse"
|
||||||
|
labels: [ ]
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
commit-message:
|
||||||
|
prefix: "feat: "
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
groups:
|
||||||
|
dependencies:
|
||||||
|
patterns:
|
||||||
|
- "rlespinasse/slugify-value"
|
||||||
|
- "rlespinasse/shortify-git-revision"
|
||||||
|
reviewers:
|
||||||
|
- "rlespinasse"
|
||||||
|
labels: [ ]
|
||||||
127
.github/workflows/github-slug-action.yml
vendored
127
.github/workflows/github-slug-action.yml
vendored
@@ -1,127 +0,0 @@
|
|||||||
name: Github Slug Action testing
|
|
||||||
on: [push, pull_request]
|
|
||||||
jobs:
|
|
||||||
os-testing:
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
concurrency:
|
|
||||||
group: os-testing-${{ github.ref }}-${{ github.event_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Load using v3.x
|
|
||||||
uses: rlespinasse/github-slug-action@v3.x
|
|
||||||
- name: Load using v4.x with prefix
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
prefix: V4_
|
|
||||||
- name: Validate // Partial variables
|
|
||||||
run: |
|
|
||||||
echo "repository owner : ${{ env.V4_GITHUB_REPOSITORY_OWNER_PART }}"
|
|
||||||
echo "repository name : ${{ env.V4_GITHUB_REPOSITORY_NAME_PART }}"
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART }}" ]]
|
|
||||||
shell: bash
|
|
||||||
- name: Validate // Slug variables
|
|
||||||
run: |
|
|
||||||
echo "repository : ${{ env.V4_GITHUB_REPOSITORY_SLUG }}"
|
|
||||||
echo "repository owner : ${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG }}"
|
|
||||||
echo "repository name : ${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG }}"
|
|
||||||
echo "ref : ${{ env.V4_GITHUB_REF_SLUG }}"
|
|
||||||
echo "head ref : ${{ env.V4_GITHUB_HEAD_REF_SLUG }}"
|
|
||||||
echo "base ref : ${{ env.V4_GITHUB_BASE_REF_SLUG }}"
|
|
||||||
echo "event ref : ${{ env.V4_GITHUB_EVENT_REF_SLUG }}"
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_SLUG }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_SLUG }}" == "${{ env.V4_GITHUB_REF_SLUG }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_HEAD_REF_SLUG }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_BASE_REF_SLUG }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_EVENT_REF_SLUG }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG }}" ]]
|
|
||||||
shell: bash
|
|
||||||
- name: Validate // Slug variables (Case Sensitive)
|
|
||||||
run: |
|
|
||||||
echo "repository : ${{ env.V4_GITHUB_REPOSITORY_SLUG_CS }}"
|
|
||||||
echo "repository owner : ${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}"
|
|
||||||
echo "repository name : ${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_CS }}"
|
|
||||||
echo "ref : ${{ env.V4_GITHUB_REF_SLUG_CS }}"
|
|
||||||
echo "head ref : ${{ env.V4_GITHUB_HEAD_REF_SLUG_CS }}"
|
|
||||||
echo "base ref : ${{ env.V4_GITHUB_BASE_REF_SLUG_CS }}"
|
|
||||||
echo "event ref : ${{ env.V4_GITHUB_EVENT_REF_SLUG_CS }}"
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_SLUG_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_REF_SLUG_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_HEAD_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_BASE_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_EVENT_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG_CS }}" ]]
|
|
||||||
shell: bash
|
|
||||||
- name: Validate // Slug URL variables
|
|
||||||
run: |
|
|
||||||
echo "repository : ${{ env.V4_GITHUB_REPOSITORY_SLUG_URL }}"
|
|
||||||
echo "repository owner : ${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}"
|
|
||||||
echo "repository name : ${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}"
|
|
||||||
echo "ref : ${{ env.V4_GITHUB_REF_SLUG_URL }}"
|
|
||||||
echo "head ref : ${{ env.V4_GITHUB_HEAD_REF_SLUG_URL }}"
|
|
||||||
echo "base ref : ${{ env.V4_GITHUB_BASE_REF_SLUG_URL }}"
|
|
||||||
echo "event ref : ${{ env.V4_GITHUB_EVENT_REF_SLUG_URL }}"
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_SLUG_URL }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG_URL }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_REF_SLUG_URL }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_HEAD_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG_URL }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_BASE_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG_URL }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_EVENT_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG_URL }}" ]]
|
|
||||||
shell: bash
|
|
||||||
- name: Validate // Slug URL variables (Case Sensitive)
|
|
||||||
run: |
|
|
||||||
echo "repository : ${{ env.V4_GITHUB_REPOSITORY_SLUG_URL_CS }}"
|
|
||||||
echo "repository owner : ${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_URL_CS }}"
|
|
||||||
echo "repository name : ${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}"
|
|
||||||
echo "ref : ${{ env.V4_GITHUB_REF_SLUG_URL_CS }}"
|
|
||||||
echo "head ref : ${{ env.V4_GITHUB_HEAD_REF_SLUG_URL_CS }}"
|
|
||||||
echo "base ref : ${{ env.V4_GITHUB_BASE_REF_SLUG_URL_CS }}"
|
|
||||||
echo "event ref : ${{ env.V4_GITHUB_EVENT_REF_SLUG_URL_CS }}"
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG_URL_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_URL_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REF_SLUG_URL_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_HEAD_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG_URL_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_BASE_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG_URL_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_EVENT_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG_URL_CS }}" ]]
|
|
||||||
shell: bash
|
|
||||||
- name: Validate // Ref Name
|
|
||||||
run: |
|
|
||||||
echo "raw : ${{ env.V4_GITHUB_REF_NAME }}"
|
|
||||||
echo "slug : ${{ env.V4_GITHUB_REF_NAME_SLUG }}"
|
|
||||||
echo "slug url : ${{ env.V4_GITHUB_REF_NAME_SLUG_URL }}"
|
|
||||||
echo "slug (Case Sensitive) : ${{ env.V4_GITHUB_REF_NAME_SLUG_CS }}"
|
|
||||||
echo "slug url (Case Sensitive) : ${{ env.V4_GITHUB_REF_NAME_SLUG_URL_CS }}"
|
|
||||||
[[ "${{ env.GITHUB_REF_NAME }}" == "${{ env.V4_GITHUB_REF_NAME }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_NAME_SLUG }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_NAME_SLUG_URL }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_URL }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_NAME_SLUG_CS }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_CS }}" ]]
|
|
||||||
[[ "${{ env.GITHUB_REF_NAME_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_URL_CS }}" ]]
|
|
||||||
shell: bash
|
|
||||||
- name: Print // Short SHA variables
|
|
||||||
run: |
|
|
||||||
echo "sha : ${{ env.V4_GITHUB_SHA_SHORT }}"
|
|
||||||
echo "pull request sha : ${{ env.V4_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
concurrency:
|
|
||||||
group: release-${{ github.ref }}-${{ github.event_name }}
|
|
||||||
needs: os-testing
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Release this GitHub Action
|
|
||||||
uses: rlespinasse/release-that@v1
|
|
||||||
with:
|
|
||||||
without-prefix: true
|
|
||||||
27
.github/workflows/linter.yml
vendored
Normal file
27
.github/workflows/linter.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
name: Lint Code Base
|
||||||
|
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Lint Code Base
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: read
|
||||||
|
statuses: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# Full git history is needed to get a proper list of changed files within `super-linter`
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Lint Code Base
|
||||||
|
uses: github/super-linter@v6
|
||||||
|
env:
|
||||||
|
VALIDATE_ALL_CODEBASE: false
|
||||||
|
DEFAULT_BRANCH: v4.x
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
398
.github/workflows/v4-tests-and-release.yml
vendored
Normal file
398
.github/workflows/v4-tests-and-release.yml
vendored
Normal file
@@ -0,0 +1,398 @@
|
|||||||
|
name: '[v4] Test and Release'
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
check-v3compatibility:
|
||||||
|
name: 'Check v3 compatibility'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Load using v4.x with prefix
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
prefix: V4_
|
||||||
|
short-length: 8
|
||||||
|
|
||||||
|
- name: Load using v3.x
|
||||||
|
uses: rlespinasse/github-slug-action@v3.x
|
||||||
|
|
||||||
|
- name: Validate // Partial variables
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART }}" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Validate // Slug variables
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_SLUG }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_SLUG }}" == "${{ env.V4_GITHUB_REF_SLUG }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_HEAD_REF_SLUG }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_BASE_REF_SLUG }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_EVENT_REF_SLUG }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG }}" ]]
|
||||||
|
shell: bash
|
||||||
|
- name: Validate // Slug variables (Case Sensitive)
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_SLUG_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_REF_SLUG_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_HEAD_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_BASE_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_EVENT_REF_SLUG_CS }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG_CS }}" ]]
|
||||||
|
shell: bash
|
||||||
|
- name: Validate // Slug URL variables
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_SLUG_URL }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG_URL }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_REF_SLUG_URL }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_HEAD_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG_URL }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_BASE_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG_URL }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_EVENT_REF_SLUG_URL }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG_URL }}" ]]
|
||||||
|
shell: bash
|
||||||
|
- name: Validate // Slug URL variables (Case Sensitive)
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_SLUG_URL_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_OWNER_PART_SLUG_URL_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REF_SLUG_URL_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_HEAD_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_HEAD_REF_SLUG_URL_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_BASE_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_BASE_REF_SLUG_URL_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_EVENT_REF_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_EVENT_REF_SLUG_URL_CS }}" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Validate // Ref Name
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_REF_NAME }}" == "${{ env.V4_GITHUB_REF_NAME }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_NAME_SLUG }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_NAME_SLUG_URL }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_URL }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_NAME_SLUG_CS }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_CS }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_REF_NAME_SLUG_URL_CS }}" == "${{ env.V4_GITHUB_REF_NAME_SLUG_URL_CS }}" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Validate // Short SHA variables
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_SHA_SHORT }}" == "${{ env.V4_GITHUB_SHA_SHORT }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" == "${{ env.V4_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
check-v3compatibility-without-checkout:
|
||||||
|
name: 'Check v3 compatibility (without checkout)'
|
||||||
|
needs:
|
||||||
|
- check-v3compatibility
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: this-action
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Load using v4.x with prefix
|
||||||
|
uses: ./this-action
|
||||||
|
with:
|
||||||
|
prefix: V4_
|
||||||
|
short-length: 8
|
||||||
|
|
||||||
|
- name: Load using v3.x
|
||||||
|
uses: rlespinasse/github-slug-action@v3.x
|
||||||
|
|
||||||
|
- name: Validate // Short SHA variables
|
||||||
|
run: |
|
||||||
|
[[ "${{ env.GITHUB_SHA_SHORT }}" == "${{ env.V4_GITHUB_SHA_SHORT }}" ]]
|
||||||
|
[[ "${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" == "${{ env.V4_GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
display:
|
||||||
|
name: 'Display produced variables'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Load using v4.x
|
||||||
|
uses: ./
|
||||||
|
|
||||||
|
- name: Partial variables
|
||||||
|
run: |
|
||||||
|
echo "repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART }}"
|
||||||
|
echo "repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Slug variables
|
||||||
|
run: |
|
||||||
|
echo "repository : ${{ env.GITHUB_REPOSITORY_SLUG }}"
|
||||||
|
echo "repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}"
|
||||||
|
echo "repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}"
|
||||||
|
echo "ref : ${{ env.GITHUB_REF_SLUG }}"
|
||||||
|
echo "head ref : ${{ env.GITHUB_HEAD_REF_SLUG }}"
|
||||||
|
echo "base ref : ${{ env.GITHUB_BASE_REF_SLUG }}"
|
||||||
|
echo "event ref : ${{ env.GITHUB_EVENT_REF_SLUG }}"
|
||||||
|
shell: bash
|
||||||
|
- name: Slug variables (Case Sensitive)
|
||||||
|
run: |
|
||||||
|
echo "repository : ${{ env.GITHUB_REPOSITORY_SLUG_CS }}"
|
||||||
|
echo "repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_CS }}"
|
||||||
|
echo "repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_CS }}"
|
||||||
|
echo "ref : ${{ env.GITHUB_REF_SLUG_CS }}"
|
||||||
|
echo "head ref : ${{ env.GITHUB_HEAD_REF_SLUG_CS }}"
|
||||||
|
echo "base ref : ${{ env.GITHUB_BASE_REF_SLUG_CS }}"
|
||||||
|
echo "event ref : ${{ env.GITHUB_EVENT_REF_SLUG_CS }}"
|
||||||
|
shell: bash
|
||||||
|
- name: Slug URL variables
|
||||||
|
run: |
|
||||||
|
echo "repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}"
|
||||||
|
echo "repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}"
|
||||||
|
echo "repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}"
|
||||||
|
echo "ref : ${{ env.GITHUB_REF_SLUG_URL }}"
|
||||||
|
echo "head ref : ${{ env.GITHUB_HEAD_REF_SLUG_URL }}"
|
||||||
|
echo "base ref : ${{ env.GITHUB_BASE_REF_SLUG_URL }}"
|
||||||
|
echo "event ref : ${{ env.GITHUB_EVENT_REF_SLUG_URL }}"
|
||||||
|
shell: bash
|
||||||
|
- name: Slug URL variables (Case Sensitive)
|
||||||
|
run: |
|
||||||
|
echo "repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL_CS }}"
|
||||||
|
echo "repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL_CS }}"
|
||||||
|
echo "repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS }}"
|
||||||
|
echo "ref : ${{ env.GITHUB_REF_SLUG_URL_CS }}"
|
||||||
|
echo "head ref : ${{ env.GITHUB_HEAD_REF_SLUG_URL_CS }}"
|
||||||
|
echo "base ref : ${{ env.GITHUB_BASE_REF_SLUG_URL_CS }}"
|
||||||
|
echo "event ref : ${{ env.GITHUB_EVENT_REF_SLUG_URL_CS }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Ref Name
|
||||||
|
run: |
|
||||||
|
echo "raw : ${{ env.GITHUB_REF_NAME }}"
|
||||||
|
echo "slug : ${{ env.GITHUB_REF_NAME_SLUG }}"
|
||||||
|
echo "slug url : ${{ env.GITHUB_REF_NAME_SLUG_URL }}"
|
||||||
|
echo "slug (Case Sensitive) : ${{ env.GITHUB_REF_NAME_SLUG_CS }}"
|
||||||
|
echo "slug url (Case Sensitive) : ${{ env.GITHUB_REF_NAME_SLUG_URL_CS }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Short SHA variables
|
||||||
|
run: |
|
||||||
|
echo "sha : ${{ env.GITHUB_SHA_SHORT }}"
|
||||||
|
echo "pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
display-without-checkout:
|
||||||
|
name: 'Display produced variables (without checkout)'
|
||||||
|
needs:
|
||||||
|
- display
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: this-action
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
- name: Load using v4.x with prefix
|
||||||
|
uses: ./this-action
|
||||||
|
with:
|
||||||
|
prefix: V4_
|
||||||
|
short-length: 8
|
||||||
|
|
||||||
|
- name: Load using v3.x
|
||||||
|
uses: rlespinasse/github-slug-action@v3.x
|
||||||
|
|
||||||
|
- name: Short SHA variables
|
||||||
|
run: |
|
||||||
|
echo "sha : ${{ env.GITHUB_SHA_SHORT }}"
|
||||||
|
echo "pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
input-short-length:
|
||||||
|
name: "Input 'short-length'"
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Test 1
|
||||||
|
- name: Using correct short length
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
prefix: 'CSL_'
|
||||||
|
short-length: 4
|
||||||
|
- name: Using correct length // Validate that all short variables lengths are equals to short-length
|
||||||
|
run: |
|
||||||
|
env | grep "CSL_" | grep "_SHORT" | cut -d"=" -f2 | while read -r value; do [ "$(echo "$value" | wc -m)" -le 5 ] ; done
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Test 2
|
||||||
|
- name: Using wrong short length
|
||||||
|
id: using-wrong-short-length
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
prefix: 'WSL_'
|
||||||
|
short-length: 'wrong'
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Using wrong short length // Validate that the action end with an error
|
||||||
|
run: |
|
||||||
|
[[ "$(env | grep "WSL_" | grep "_SHORT" | wc -l)" -eq 0 ]]
|
||||||
|
[[ "${{ steps.using-wrong-short-length.outcome }}" == "failure" ]]
|
||||||
|
[[ "${{ steps.using-wrong-short-length.conclusion }}" == "success" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
input-short-length-without-checkout:
|
||||||
|
name: "Input 'short-length' (without checkout)"
|
||||||
|
needs:
|
||||||
|
- input-short-length
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: this-action
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
|
||||||
|
# Test 1
|
||||||
|
- name: Using correct short length
|
||||||
|
uses: ./this-action
|
||||||
|
with:
|
||||||
|
prefix: 'CSL_'
|
||||||
|
short-length: 4
|
||||||
|
- name: Using correct length // Validate that all short variables lengths are equals to short-length
|
||||||
|
run: |
|
||||||
|
env | grep "CSL_" | grep "_SHORT" | cut -d"=" -f2 | while read -r value; do [ "$(echo "$value" | wc -m)" -le 5 ] ; done
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Test 2
|
||||||
|
- name: Using empty short length
|
||||||
|
id: using-empty-short-length
|
||||||
|
uses: ./this-action
|
||||||
|
with:
|
||||||
|
prefix: 'ESL_'
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Using empty short length // Validate that the action don't end with an error
|
||||||
|
run: |
|
||||||
|
[[ "$(env | grep "ESL_" | grep "_SHORT" | wc -l)" -gt 0 ]]
|
||||||
|
[[ "${{ steps.using-empty-short-length.outcome }}" == "success" ]]
|
||||||
|
[[ "${{ steps.using-empty-short-length.conclusion }}" == "success" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Test 3
|
||||||
|
- name: Using wrong short length
|
||||||
|
id: using-wrong-short-length
|
||||||
|
uses: ./this-action
|
||||||
|
with:
|
||||||
|
prefix: 'WSL_'
|
||||||
|
short-length: 'wrong'
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Using wrong short length // Validate that the action end with an error
|
||||||
|
run: |
|
||||||
|
[[ "$(env | grep "WSL_" | grep "_SHORT" | wc -l)" -eq 0 ]]
|
||||||
|
[[ "${{ steps.using-wrong-short-length.outcome }}" == "failure" ]]
|
||||||
|
[[ "${{ steps.using-wrong-short-length.conclusion }}" == "success" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
input-slug-maxlength:
|
||||||
|
name: "Input 'slug-maxlength'"
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Test 1
|
||||||
|
- name: Using correct slug max length
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
prefix: 'CML_'
|
||||||
|
slug-maxlength: 1
|
||||||
|
- name: Using correct max length // Validate that all slug variables lengths are equals or under the slug-maxlength
|
||||||
|
run: |
|
||||||
|
env | grep "CML_" | grep "_SLUG" | cut -d"=" -f2 | while read -r value; do [ "$(echo "$value" | wc -m)" -le 2 ] ; done
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Test 2
|
||||||
|
- name: Using wrong slug max length
|
||||||
|
id: using-wrong-slug-max-length
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
prefix: 'WML_'
|
||||||
|
slug-maxlength: 'wrong'
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Using wrong slug max length // Validate that the action end with an error
|
||||||
|
run: |
|
||||||
|
[[ "$(env | grep "WML_" | grep "_SLUG" | wc -l)" -eq 0 ]]
|
||||||
|
[[ "${{ steps.using-wrong-slug-max-length.outcome }}" == "failure" ]]
|
||||||
|
[[ "${{ steps.using-wrong-slug-max-length.conclusion }}" == "success" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Test 3
|
||||||
|
- name: Using empty slug max length
|
||||||
|
id: using-empty-slug-max-length
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
prefix: 'EML_'
|
||||||
|
slug-maxlength: ''
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Using empty slug max length // Validate that the action end with an error
|
||||||
|
run: |
|
||||||
|
[[ "$(env | grep "EML_" | grep "_SLUG" | wc -l)" -eq 0 ]]
|
||||||
|
[[ "${{ steps.using-empty-slug-max-length.outcome }}" == "failure" ]]
|
||||||
|
[[ "${{ steps.using-empty-slug-max-length.conclusion }}" == "success" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# Test 4
|
||||||
|
- name: Using no limit on slug max length
|
||||||
|
id: using-nolimit-slug-max-length
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
prefix: 'NLML_'
|
||||||
|
slug-maxlength: 'nolimit'
|
||||||
|
- name: Using no limit on slug max length // Validate that the action end with an error
|
||||||
|
run: |
|
||||||
|
[[ "$(env | grep "NLML_" | grep "_SLUG" | wc -l)" -gt 0 ]]
|
||||||
|
[[ "${{ steps.using-nolimit-slug-max-length.outcome }}" == "success" ]]
|
||||||
|
[[ "${{ steps.using-nolimit-slug-max-length.conclusion }}" == "success" ]]
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
concurrency:
|
||||||
|
group: release-${{ github.ref }}-${{ github.event_name }}
|
||||||
|
needs:
|
||||||
|
- check-v3compatibility-without-checkout
|
||||||
|
- display-without-checkout
|
||||||
|
- input-short-length-without-checkout
|
||||||
|
- input-slug-maxlength
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Release this GitHub Action
|
||||||
|
uses: rlespinasse/release-that@v1
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GH_TOKEN }}
|
||||||
79
CHANGELOG.md
79
CHANGELOG.md
@@ -1,79 +0,0 @@
|
|||||||
# [3.6.0](http://github.com/rlespinasse/github-slug-action/compare/3.5.1...3.6.0) (2021-09-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add GITHUB_REF_NAME env var ([12a7510](http://github.com/rlespinasse/github-slug-action/commit/12a75106304d45442301df66d3ba38e1ac002649))
|
|
||||||
|
|
||||||
## [3.5.1](http://github.com/rlespinasse/github-slug-action/compare/3.5.0...3.5.1) (2021-03-31)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* update dist files ([e6c550f](http://github.com/rlespinasse/github-slug-action/commit/e6c550f88ccca52a82675b89186b6b72864f087c))
|
|
||||||
|
|
||||||
# [3.5.0](http://github.com/rlespinasse/github-slug-action/compare/3.4.0...3.5.0) (2021-03-30)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* allow underscore in slug values ([475d293](http://github.com/rlespinasse/github-slug-action/commit/475d293680b998a3315846828329f05bfff4ac9c))
|
|
||||||
|
|
||||||
# [3.4.0](http://github.com/rlespinasse/github-slug-action/compare/3.3.0...3.4.0) (2021-03-02)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add _CS suffix to keep value case-sensitive ([6c93fcb](http://github.com/rlespinasse/github-slug-action/commit/6c93fcbf53da9c6415bd7f5e37579b488f34339e))
|
|
||||||
|
|
||||||
# [3.3.0](http://github.com/rlespinasse/github-slug-action/compare/3.2.0...3.3.0) (2021-01-25)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* support pull-request for slug and slug url ([78985f8](http://github.com/rlespinasse/github-slug-action/commit/78985f84eca97ef1c5262e85e8a73a277494c4ed))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* support partial GITHUB_REPOSITORY ([75ce03b](http://github.com/rlespinasse/github-slug-action/commit/75ce03b6a055a3be9d936a3a99c51038bd72298c))
|
|
||||||
|
|
||||||
# [3.2.0](http://github.com/rlespinasse/github-slug-action/compare/3.1.0...3.2.0) (2021-01-12)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* expose GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT ([5b9fe60](http://github.com/rlespinasse/github-slug-action/commit/5b9fe6015d2facc71c81d53bf3b08f04e0f3f743))
|
|
||||||
|
|
||||||
# [3.1.0](http://github.com/rlespinasse/github-slug-action/compare/3.0.0...3.1.0) (2020-11-01)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **action:** improve marketplace information ([3cddc4f](http://github.com/rlespinasse/github-slug-action/commit/3cddc4f12d7a6fdbb8b1221dc02a2c64670e54bf))
|
|
||||||
|
|
||||||
# [3.0.0](http://github.com/rlespinasse/github-slug-action/compare/2.1.0...3.0.0) (2020-10-26)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* upgrade actions core due to CVE fix ([d0549c1](http://github.com/rlespinasse/github-slug-action/commit/d0549c1f85ab9567b439f9d660b01ce1142b9fbe))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add support for windows and macos jobs ([13c2f38](http://github.com/rlespinasse/github-slug-action/commit/13c2f38dad5f32529f37c25736412b1e4cf687fe))
|
|
||||||
|
|
||||||
|
|
||||||
### BREAKING CHANGES
|
|
||||||
|
|
||||||
* The action implementation move from container action to node.js action
|
|
||||||
|
|
||||||
Co-authored-by: Romain Lespinasse <romain.lespinasse@gmail.com>
|
|
||||||
|
|
||||||
# [2.1.0](http://github.com/rlespinasse/github-slug-action/compare/2.0.0...2.1.0) (2020-07-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* expose slug variables for github.event.ref ([5a334a8](http://github.com/rlespinasse/github-slug-action/commit/5a334a8573fc27451af5b2a6ee175d8e11579e10))
|
|
||||||
186
README.md
186
README.md
@@ -1,10 +1,6 @@
|
|||||||
# GitHub Slug action
|
# GitHub Slug action
|
||||||
|
|
||||||
[![Release][release-badge]][releases]
|
This GitHub Action will expose the slug/short values of [some GitHub environment variables][default-environment-variables] inside your GitHub workflow.
|
||||||
![Lint][lint-badge]
|
|
||||||
[![Licence][license-badge]][license]
|
|
||||||
|
|
||||||
This GitHub Action will expose the slug/short values of [some GitHub environment variables][github-env-vars] inside your GitHub workflow.
|
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -12,6 +8,7 @@ This GitHub Action will expose the slug/short values of [some GitHub environment
|
|||||||
- [Table of Contents](#table-of-contents)
|
- [Table of Contents](#table-of-contents)
|
||||||
- [Overview](#overview)
|
- [Overview](#overview)
|
||||||
- [Use this action](#use-this-action)
|
- [Use this action](#use-this-action)
|
||||||
|
- [Migration from previous versions](#migration-from-previous-versions)
|
||||||
- [Available Environment variables](#available-environment-variables)
|
- [Available Environment variables](#available-environment-variables)
|
||||||
- [Enhanced variables](#enhanced-variables)
|
- [Enhanced variables](#enhanced-variables)
|
||||||
- [Partial variables](#partial-variables)
|
- [Partial variables](#partial-variables)
|
||||||
@@ -19,7 +16,10 @@ This GitHub Action will expose the slug/short values of [some GitHub environment
|
|||||||
- [Slug URL variables](#slug-url-variables)
|
- [Slug URL variables](#slug-url-variables)
|
||||||
- [Short variables](#short-variables)
|
- [Short variables](#short-variables)
|
||||||
- [Troubleshooting](#troubleshooting)
|
- [Troubleshooting](#troubleshooting)
|
||||||
|
- [The SHORT variables doesn't have the same lengths as before](#the-short-variables-doesnt-have-the-same-lengths-as-before)
|
||||||
- [One of the environment variables doesn't work as intended](#one-of-the-environment-variables-doesnt-work-as-intended)
|
- [One of the environment variables doesn't work as intended](#one-of-the-environment-variables-doesnt-work-as-intended)
|
||||||
|
- [Known environment variable conflicts](#known-environment-variable-conflicts)
|
||||||
|
- [GITHUB_REF_NAME](#github_ref_name)
|
||||||
- [An action could not be found at the URI](#an-action-could-not-be-found-at-the-uri)
|
- [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)
|
- [Thanks for talking about us](#thanks-for-talking-about-us)
|
||||||
|
|
||||||
@@ -29,15 +29,16 @@ This GitHub Action will expose the slug/short values of [some GitHub environment
|
|||||||
|
|
||||||
- put the variable content in lower case
|
- put the variable content in lower case
|
||||||
- replace any character by `-` except `0-9`, `a-z`, `.`, and `_`
|
- replace any character by `-` except `0-9`, `a-z`, `.`, and `_`
|
||||||
- remove leading and trailing `-` character
|
- remove leading `-` characters
|
||||||
- limit the string size to 63 characters
|
- limit the string size to 63 characters
|
||||||
|
- remove trailing `-` characters
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Others <b>Slug-ish</b> commands are available</summary>
|
<summary>Others <b>Slug-ish</b> commands are available</summary>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
- `SLUG_URL` on a variable to have a `slug` variable compliant to be used in an URL
|
- `SLUG_URL` on a variable to have a `slug` variable compliant to be used in an URL
|
||||||
- Like `SLUG` but `.` is also replaced by `-`
|
- Like `SLUG` but `.`, and `_` are also replaced by `-`
|
||||||
- `SHORT` on a variable will limit the string size to ~8 characters
|
- `SHORT` on a variable will limit the string size to ~8 characters
|
||||||
- Useful for _sha_ value
|
- Useful for _sha_ value
|
||||||
- `<KEY>_PART` on a variable will give a part of a variable defined by a key
|
- `<KEY>_PART` on a variable will give a part of a variable defined by a key
|
||||||
@@ -45,11 +46,10 @@ This GitHub Action will expose the slug/short values of [some GitHub environment
|
|||||||
- `<VAR>_CS` on others variables to keep the value case-sensitive
|
- `<VAR>_CS` on others variables to keep the value case-sensitive
|
||||||
- Like `GITHUB_REF_SLUG_CS`
|
- Like `GITHUB_REF_SLUG_CS`
|
||||||
|
|
||||||
|
Additional enhanced environment variables can be compute to help you around GitHub environment variables.
|
||||||
</p>
|
</p>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
Additional enhanced environment variables can be compute to help you around GitHub environment variables.
|
|
||||||
|
|
||||||
## Use this action
|
## Use this action
|
||||||
|
|
||||||
Add this in your workflow
|
Add this in your workflow
|
||||||
@@ -59,19 +59,61 @@ Add this in your workflow
|
|||||||
uses: rlespinasse/github-slug-action@v4
|
uses: rlespinasse/github-slug-action@v4
|
||||||
```
|
```
|
||||||
|
|
||||||
Or with a prefix
|
<details>
|
||||||
|
<summary>Others configurations</summary>
|
||||||
|
<p>
|
||||||
|
|
||||||
|
- With a prefix
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Inject slug/short variables
|
||||||
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
with:
|
||||||
|
prefix: CI_
|
||||||
|
```
|
||||||
|
|
||||||
|
- With another max length for slug values
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Inject slug/short variables
|
||||||
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
with:
|
||||||
|
slug-maxlength: 80 # Use 'nolimit' to remove use of a max length (Default to 63)
|
||||||
|
```
|
||||||
|
|
||||||
|
- With another length for short values
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Inject slug/short variables
|
||||||
|
uses: rlespinasse/github-slug-action@v4
|
||||||
|
with:
|
||||||
|
short-length: 7 # By default it's up to git to decide, use 8 to have the v3.x behavior
|
||||||
|
```
|
||||||
|
|
||||||
|
**Warning**: If you leave it empty, you need to checkout the source first in order to let git decide the size by itself.
|
||||||
|
</p>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
Check for more [examples][examples] (OS usage, URL use, ...)
|
||||||
|
|
||||||
|
**Tip:** Use [Dependabot][dependabot] to maintain your `github-slug-action` version updated in your GitHub workflows.
|
||||||
|
|
||||||
|
### Migration from previous versions
|
||||||
|
|
||||||
|
The short sha length is not the same as previous version.
|
||||||
|
|
||||||
|
- `v4` let git configuration decide of it (but you can override it),
|
||||||
|
- `v3` and before, it's always a length of 8 characters.
|
||||||
|
|
||||||
|
So to reproduce previous behavior, use
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Inject slug/short variables
|
- name: Inject slug/short variables
|
||||||
uses: rlespinasse/github-slug-action@v4
|
uses: rlespinasse/github-slug-action@v4
|
||||||
with:
|
with:
|
||||||
prefix: CI_
|
short-length: 8 # Same as v3 and before
|
||||||
```
|
```
|
||||||
|
|
||||||
Check for more [examples][examples] (OS usage, URL use, ...)
|
|
||||||
|
|
||||||
**Tip:** Use [Dependabot][dependabot] to maintain your `github-slug-action` version updated in your GitHub workflows.
|
|
||||||
|
|
||||||
## Available Environment variables
|
## Available Environment variables
|
||||||
|
|
||||||
**Note**: If you don't find what you search for, read more about [available `GitHub` variables](docs/github-variables.md), and propose a [new custom variable][custom-variable].
|
**Note**: If you don't find what you search for, read more about [available `GitHub` variables](docs/github-variables.md), and propose a [new custom variable][custom-variable].
|
||||||
@@ -128,75 +170,109 @@ Check for more [examples][examples] (OS usage, URL use, ...)
|
|||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
### The SHORT variables doesn't have the same lengths as before
|
||||||
|
|
||||||
|
Since `v4`, it's git who manage the short variables by using [git rev-parse][git-revparse] behaviour.
|
||||||
|
The length of a short sha depends of the size of our repository and can differ over time.
|
||||||
|
|
||||||
|
To manage that moving length, you can use `short-length` input
|
||||||
|
|
||||||
|
- set `7` to reproduce `small repository` behavior
|
||||||
|
- set `8` to reproduce `v3` behavior
|
||||||
|
|
||||||
|
**Warning**: The minimum length is 4, the default is the effective value of the [core.abbrev][git-core-abbrev] configuration variable.
|
||||||
|
|
||||||
### One of the environment variables doesn't work as intended
|
### One of the environment variables doesn't work as intended
|
||||||
|
|
||||||
[**Note**][naming-conventions]: 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.
|
[**Note**][naming-conventions]: When you set a custom environment variable, you cannot use any of the default environment variable names. 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.**
|
||||||
|
|
||||||
Currently, a GitHub workflow setting a `GITHUB_` variable will not cause an error, it will just fail silently.
|
If a variable start to be used as default environment variable, the environment variable may have a different behavior than the expected one.
|
||||||
And if a custom `GITHUB_` variable is in conflict with an official `GITHUB_` variable, the offical `GITHUB_` variable will override custom one.
|
|
||||||
|
|
||||||
<details>
|
If this append, the `${{ env.GITHUB_AWESOME_VARIABLE }}` and `$GITHUB_AWESOME_VARIABLE` expression will not works in the same way.
|
||||||
<summary>Test workflow</summary>
|
|
||||||
<p>
|
- `${{ env.GITHUB_AWESOME_VARIABLE }}` will serve the behavior of this action,
|
||||||
|
- `$GITHUB_AWESOME_VARIABLE` will serve the behavior of GitHub Action.
|
||||||
|
|
||||||
|
Otherwise the two expression will serve the behavior of this action.
|
||||||
|
This will not occurs if you use the `prefix` input to avoid the issue.
|
||||||
|
|
||||||
|
**NOTE:** If detected, the maintainers of this action will choose the best course of action depending of the impact.
|
||||||
|
|
||||||
|
#### Known environment variable conflicts
|
||||||
|
|
||||||
|
##### GITHUB_REF_NAME
|
||||||
|
|
||||||
|
The behavior is the same as the GitHub one except on `pull_request*` workflows ([Ready the full story][issue-104]).
|
||||||
|
|
||||||
|
- `${{ env.GITHUB_REF_NAME }}` will serve the behavior of this action,
|
||||||
|
- `$GITHUB_REF_NAME` will serve the behavior of GitHub Action.
|
||||||
|
|
||||||
|
On `pull_request*` workflows, the content will be `<PR-number>/merge` instead of the branch name.
|
||||||
|
|
||||||
|
A possible workaround is to use `prefix` input
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Test
|
- name: Inject slug/short variables
|
||||||
on: push
|
uses: rlespinasse/github-slug-action@v4
|
||||||
jobs:
|
with:
|
||||||
build:
|
prefix: CI_
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo ${GITHUB_REF}
|
|
||||||
# print "refs/heads/v4.x"
|
|
||||||
- run: echo "GITHUB_REF=one_value" >> "$GITHUB_ENV"
|
|
||||||
- run: echo ${GITHUB_REF}
|
|
||||||
# print "refs/heads/v4.x"
|
|
||||||
- run: echo "GITHUB_REF_SLUG=another_value" >> "$GITHUB_ENV"
|
|
||||||
- run: echo ${GITHUB_REF_SLUG}
|
|
||||||
# print "another_value"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
</p>
|
Then `${{ env.CI_GITHUB_REF_NAME }}`, and `$CI_GITHUB_REF_NAME` will serve the behavior of this action.
|
||||||
</details>
|
And `$GITHUB_REF_NAME` will serve the behavior of GitHub Action.
|
||||||
|
|
||||||
### An action could not be found at the URI
|
### An action could not be found at the URI
|
||||||
|
|
||||||
If your workflow fail on the `Set up job` task with this kind of log :
|
If your workflow fail on the `Set up job` task with this kind of log
|
||||||
|
|
||||||
```text
|
```text
|
||||||
Download action repository 'rlespinasse/github-slug-action@master'
|
Download action repository 'rlespinasse/github-slug-action@GIT_REFERENCE'
|
||||||
##[error]An action could not be found at the URI 'https://api.github.com/repos/rlespinasse/github-slug-action/tarball/master'
|
##[error]An action could not be found at the URI 'https://api.github.com/repos/rlespinasse/github-slug-action/tarball/GIT_REFERENCE'
|
||||||
```
|
```
|
||||||
|
|
||||||
> The master branch doesn't exists anymore.
|
If the `GIT_REFERENCE` value is
|
||||||
>
|
|
||||||
> The master branch EOL has been set to **2020-10-25** after a 6-month deprecation period (more information on the [EOL issue][issue-15])
|
|
||||||
|
|
||||||
Please, use the current branch tag `v4`, branch `v4.x` or a version tag (see [releases pages][releases]) in order to fix your workflow.
|
- `v4.x` or after, the branch don't exists anymore following the [end-of-life for a branch](SECURITY.md#end-of-life-of-a-branch) security process.
|
||||||
|
- `master`, the branch don't exists anymore, read more about it on the corresponding issue ([EOL issue][issue-15])
|
||||||
|
|
||||||
|
Please, use the current major tag `v4` or a version tag (see [releases pages][releases]) in order to fix your workflow.
|
||||||
|
|
||||||
## Thanks for talking about us
|
## Thanks for talking about us
|
||||||
|
|
||||||
- [Mettre en place une CI/CD Angular avec GitHub Actions & Netlify][article-1] (in french :fr:)
|
In English :gb:
|
||||||
- [Github Actions : enfin des pipelines accessibles aux développeurs][talk-1] (in french :fr:)
|
|
||||||
- [Action spotlight by Michael Heap][article-2]
|
- [Action spotlight by Michael Heap][article-2]
|
||||||
- The next one is you. _Don't hesitate to add youself to this list._
|
- [Serverless Deploy Previews on GitHub Actions][article-3]
|
||||||
|
- [Let's Build a Continuous Delivery and Branching Process with Github Actions, Vercel and Heroku][article-4]
|
||||||
|
|
||||||
[release-badge]: https://img.shields.io/github/workflow/status/rlespinasse/github-slug-action/Release?label=Build&logo=github&style=flat-square
|
In French :fr:
|
||||||
[lint-badge]: https://img.shields.io/github/workflow/status/rlespinasse/github-slug-action/Lint?label=Lint&logo=github&style=flat-square
|
|
||||||
[license-badge]: https://img.shields.io/github/license/rlespinasse/github-slug-action?style=flat-square
|
- [Mettre en place une CI/CD Angular avec GitHub Actions & Netlify][article-1]
|
||||||
|
- [Github Actions : enfin des pipelines accessibles aux développeurs][talk-1]
|
||||||
|
|
||||||
|
In Chinese :cn:
|
||||||
|
|
||||||
|
- [利用github-slug-action暴漏Github Action上下文中的关键变量][article-5]
|
||||||
|
|
||||||
|
> The next one is you. _Don't hesitate to add youself to one of these lists._
|
||||||
|
|
||||||
[actions]: https://github.com/rlespinasse/github-slug-action/actions
|
|
||||||
[license]: https://github.com/rlespinasse/github-slug-action/blob/v4.x/LICENSE
|
|
||||||
[examples]: https://github.com/rlespinasse/github-slug-action/tree/v4.x/examples
|
[examples]: https://github.com/rlespinasse/github-slug-action/tree/v4.x/examples
|
||||||
[custom-variable]: https://github.com/rlespinasse/github-slug-action/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=
|
[custom-variable]: https://github.com/rlespinasse/github-slug-action/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=
|
||||||
[releases]: https://github.com/rlespinasse/github-slug-action/releases
|
[releases]: https://github.com/rlespinasse/github-slug-action/releases
|
||||||
[issue-15]: https://github.com/rlespinasse/github-slug-action/issues/15
|
[issue-15]: https://github.com/rlespinasse/github-slug-action/issues/15
|
||||||
|
[issue-104]: https://github.com/rlespinasse/github-slug-action/issues/104
|
||||||
|
|
||||||
[github-env-vars]: https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables
|
[git-revparse]: https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt---shortlength
|
||||||
[dependabot]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot
|
[git-core-abbrev]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreabbrev
|
||||||
|
|
||||||
|
[default-environment-variables]: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
|
||||||
|
[dependabot]: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
|
||||||
[webhooks-and-events]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads
|
[webhooks-and-events]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads
|
||||||
[naming-conventions]: https://docs.github.com/en/actions/reference/environment-variables#naming-conventions-for-environment-variables
|
[naming-conventions]: https://docs.github.com/en/actions/reference/environment-variables#naming-conventions-for-environment-variables
|
||||||
|
|
||||||
[article-1]: https://esensconsulting.medium.com/mettre-en-place-une-ci-cd-angular-avec-github-actions-netlify-ca0b59b99ed8
|
[article-1]: https://esensconsulting.medium.com/mettre-en-place-une-ci-cd-angular-avec-github-actions-netlify-ca0b59b99ed8
|
||||||
[article-2]: https://michaelheap.com/github-slug-action/
|
[article-2]: https://michaelheap.com/github-slug-action/
|
||||||
[talk-1]: https://www.youtube.com/watch?v=RHnTJBwcE98
|
[article-3]: https://barstool.engineering/serverless-deploy-previews-on-github-actions/
|
||||||
|
[article-4]: https://javascript.plainenglish.io/lets-build-a-continuous-delivery-and-branching-process-c27dae09f0b6
|
||||||
|
[article-5]: https://eryajf.github.io/HowToStartOpenSource/views/03-github-tips/10-Use-github-slug-action-to-leak-key-variables-in-the-Github-Action-context.html
|
||||||
|
[talk-1]: https://www.youtube.com/watch?v=F5mBDmOQcvE
|
||||||
|
|||||||
33
SECURITY.md
33
SECURITY.md
@@ -2,34 +2,25 @@
|
|||||||
|
|
||||||
## Supported Versions and Branches
|
## Supported Versions and Branches
|
||||||
|
|
||||||
We only support 2 major versions for security patches
|
| Version | Supported | End of Support | Branch | Specific Tags |
|
||||||
|
| ------- | ------------------ | -------------- | ------ | ------------- |
|
||||||
| Version | Branch | Supported | Specific Tags |
|
| 4.x | :white_check_mark: | | v4.x | v4 |
|
||||||
| ------- | ------ | ------------------ | ------------- |
|
| 3.x | :white_check_mark: | 2024-01-31 | v3.x | v3 |
|
||||||
| 4.x | v4.x | :white_check_mark: | v4 |
|
| 2.x | :x: | 2021-04-05 | | v2.x, 2.2.0 |
|
||||||
| 3.x | v3.x | :white_check_mark: | |
|
| 1.x | :x: | 2021-04-05 | | v1.1.x, 1.2.0 |
|
||||||
| < 2.x | | :x: | v2.x, v1.1.x |
|
| 1.0.x | :x: | 2019-11-07 | | 1.0.2 |
|
||||||
|
|
||||||
A GitHub repository can used one of the available branches as action inside its workflows.
|
A GitHub repository can used one of the available branches as action inside its workflows.
|
||||||
|
|
||||||
### End of Life of a branch
|
### End of Life of a branch
|
||||||
|
|
||||||
When a branch is not supported anymore, the following process occurs
|
Since `2023-10-20`, when a new major version is release,
|
||||||
|
|
||||||
- Since `v4.x` branch, the branch will be deleted 2 major versions after
|
- The previous one will continue to receive security patches during a 3-months periods,
|
||||||
- So `v4.x` branch will be deleted when `v7.x` branch will have its first release
|
- After the 3-month periods, the branch is deleted, only the tags remains.
|
||||||
- prefer the `v4` tag to `v4.x` branch as reference in our workflow,
|
|
||||||
- Before `v4.x` branch, the branch will be converted into a tag when the support is dropped
|
|
||||||
- So `v3.x` branch will be converted as tag when `v5.x` branch will have its first release
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
You can report a Vulnerability by [my email](mailto:romain.lespinasse@gmail.com).
|
You can report a Vulnerability by creating a [draft security advisory](https://github.com/rlespinasse/github-slug-action/security/advisories) in this project.
|
||||||
|
|
||||||
_Vulnerability stages :_
|
If the vulnerability is confirm, a fix will be produce and the advisory will be publish.
|
||||||
|
|
||||||
- Reported,
|
|
||||||
- Confirmed (or declined),
|
|
||||||
- Fixed on maintained version series.
|
|
||||||
|
|
||||||
After a vulnerability fix, an GitHub issue will be created as document this vulnerability.
|
|
||||||
|
|||||||
82
action.yml
82
action.yml
@@ -9,69 +9,107 @@ inputs:
|
|||||||
description: "Value to prepend to each generated variable"
|
description: "Value to prepend to each generated variable"
|
||||||
default: ""
|
default: ""
|
||||||
required: false
|
required: false
|
||||||
|
slug-maxlength:
|
||||||
|
description: "Max length of the slugified values"
|
||||||
|
default: "63"
|
||||||
|
required: true
|
||||||
|
short-length:
|
||||||
|
description: "Length of the shortify values (git default if empty)"
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
- run: $GITHUB_ACTION_PATH/preflight.sh
|
||||||
|
id: prefligth
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
INPUT_SLUG_MAXLENGTH: ${{ inputs.slug-maxlength }}
|
||||||
|
INPUT_SHORT_LENGTH: ${{ inputs.short-length }}
|
||||||
|
|
||||||
|
# From Environment Variables
|
||||||
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
with:
|
with:
|
||||||
key: GITHUB_REPOSITORY
|
key: GITHUB_REPOSITORY
|
||||||
value: ${{ github.repository }}
|
value: ${{ github.repository }}
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
with:
|
with:
|
||||||
key: GITHUB_REF
|
key: GITHUB_REF
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
with:
|
with:
|
||||||
key: GITHUB_HEAD_REF
|
key: GITHUB_HEAD_REF
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
with:
|
with:
|
||||||
key: GITHUB_BASE_REF
|
key: GITHUB_BASE_REF
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
|
|
||||||
# Specific values
|
# From Specific values
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
with:
|
with:
|
||||||
key: GITHUB_EVENT_REF
|
key: GITHUB_EVENT_REF
|
||||||
value: ${{ github.event.ref }}
|
value: ${{ github.event.ref }}
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
# Calculated values
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
- id: get-github-ref-name
|
|
||||||
run: echo "::set-output name=github-ref-name::$(echo "${{ github.head_ref || github.ref }}" | cut -d/ -f3)"
|
|
||||||
shell: bash
|
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
|
||||||
with:
|
with:
|
||||||
key: GITHUB_REF_NAME
|
key: GITHUB_REF_NAME
|
||||||
value: ${{ steps.get-github-ref-name.outputs.github-ref-name }}
|
# Related to https://github.com/rlespinasse/github-slug-action/issues/104
|
||||||
|
value: ${{ env.GITHUB_HEAD_REF_RAW || env.GITHUB_REF_NAME_RAW }}
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
|
env:
|
||||||
|
GITHUB_HEAD_REF_RAW: ${{ github.head_ref }}
|
||||||
|
GITHUB_REF_NAME_RAW: ${{ github.ref_name }}
|
||||||
|
|
||||||
|
# From Calculated values
|
||||||
- id: get-github-repository-owner-part
|
- id: get-github-repository-owner-part
|
||||||
run: echo "::set-output name=github-repository-owner-part::$(echo $GITHUB_REPOSITORY | cut -d/ -f1)"
|
run: |
|
||||||
|
ownerpart=$(echo $GITHUB_REPOSITORY | cut -d/ -f1)
|
||||||
|
if [ -f "$GITHUB_OUTPUT" ]; then
|
||||||
|
echo "github-repository-owner-part=${ownerpart}" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "::set-output name=github-repository-owner-part::${ownerpart}"
|
||||||
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
with:
|
with:
|
||||||
key: GITHUB_REPOSITORY_OWNER_PART
|
key: GITHUB_REPOSITORY_OWNER_PART
|
||||||
value: ${{ steps.get-github-repository-owner-part.outputs.github-repository-owner-part }}
|
value: ${{ steps.get-github-repository-owner-part.outputs.github-repository-owner-part }}
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
- id: get-github-repository-name-part
|
- id: get-github-repository-name-part
|
||||||
run: echo "::set-output name=github-repository-name-part::$(echo $GITHUB_REPOSITORY | cut -d/ -f2)"
|
run: |
|
||||||
|
namepart=$(echo $GITHUB_REPOSITORY | cut -d/ -f2)
|
||||||
|
if [ -f "$GITHUB_OUTPUT" ]; then
|
||||||
|
echo "github-repository-name-part=${namepart}" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "::set-output name=github-repository-name-part::${namepart}"
|
||||||
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
- uses: rlespinasse/slugify-value@v1.1.0
|
- uses: rlespinasse/slugify-value@v1.4.0
|
||||||
with:
|
with:
|
||||||
key: GITHUB_REPOSITORY_NAME_PART
|
key: GITHUB_REPOSITORY_NAME_PART
|
||||||
value: ${{ steps.get-github-repository-name-part.outputs.github-repository-name-part }}
|
value: ${{ steps.get-github-repository-name-part.outputs.github-repository-name-part }}
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
|
slug-maxlength: ${{ inputs.slug-maxlength }}
|
||||||
|
|
||||||
# Short
|
# From sha
|
||||||
- uses: rlespinasse/shortify-git-revision@v1.3.0
|
- uses: rlespinasse/shortify-git-revision@v1.6.0
|
||||||
with:
|
with:
|
||||||
name: GITHUB_SHA
|
name: GITHUB_SHA
|
||||||
continue-on-error: true
|
short-on-error: true
|
||||||
|
length: ${{ steps.prefligth.outputs.PREFLIGHT_SHORT_LENGTH }}
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
- uses: rlespinasse/shortify-git-revision@v1.3.0
|
- uses: rlespinasse/shortify-git-revision@v1.6.0
|
||||||
with:
|
with:
|
||||||
name: GITHUB_EVENT_PULL_REQUEST_HEAD_SHA
|
name: GITHUB_EVENT_PULL_REQUEST_HEAD_SHA
|
||||||
revision: ${{ github.event.pull_request.head.sha }}
|
revision: ${{ github.event.pull_request.head.sha }}
|
||||||
continue-on-error: true
|
short-on-error: true
|
||||||
|
length: ${{ steps.prefligth.outputs.PREFLIGHT_SHORT_LENGTH }}
|
||||||
prefix: ${{ inputs.prefix }}
|
prefix: ${{ inputs.prefix }}
|
||||||
|
|||||||
38
preflight.sh
Executable file
38
preflight.sh
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [ -z "${INPUT_SLUG_MAXLENGTH}" ]; then
|
||||||
|
echo "::error ::slug-maxlength cannot be empty"
|
||||||
|
exit 1
|
||||||
|
elif [ "${INPUT_SLUG_MAXLENGTH}" != "nolimit" ] && [ ! "${INPUT_SLUG_MAXLENGTH}" -eq "${INPUT_SLUG_MAXLENGTH}" ] 2>/dev/null; then
|
||||||
|
echo "::error ::slug-maxlength must be a number or equals to 'nolimit'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! "${INPUT_SHORT_LENGTH}" -eq "${INPUT_SHORT_LENGTH}" ] 2>/dev/null; then
|
||||||
|
echo "::error ::short-length must be a number"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "::debug ::Control preflight short-length setup"
|
||||||
|
PREFLIGHT_SHORT_LENGTH=""
|
||||||
|
if [ -n "${INPUT_SHORT_LENGTH}" ]; then
|
||||||
|
PREFLIGHT_SHORT_LENGTH="${INPUT_SHORT_LENGTH}"
|
||||||
|
echo "::debug ::Use input value: $PREFLIGHT_SHORT_LENGTH"
|
||||||
|
elif [ "$(git rev-parse --is-inside-work-tree)" == "true" ]; then
|
||||||
|
echo "::debug ::The action run inside a git repository, short-length can be empty"
|
||||||
|
else
|
||||||
|
echo "::debug ::The action run outside a git repository, need to set short-length"
|
||||||
|
PREFLIGHT_SHORT_LENGTH="$(git config --get core.abbrev)"
|
||||||
|
if [ -n "${PREFLIGHT_SHORT_LENGTH}" ]; then
|
||||||
|
echo "::debug ::Git Configuration 'core.abbrev' is set, using it as short-length"
|
||||||
|
else
|
||||||
|
PREFLIGHT_SHORT_LENGTH="7"
|
||||||
|
echo "::debug ::Using fallback value for short-length"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "::debug ::Set PREFLIGHT_SHORT_LENGTH=$PREFLIGHT_SHORT_LENGTH"
|
||||||
|
if [ -f "$GITHUB_OUTPUT" ]; then
|
||||||
|
echo "PREFLIGHT_SHORT_LENGTH=${PREFLIGHT_SHORT_LENGTH}" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "::set-output name=PREFLIGHT_SHORT_LENGTH::${PREFLIGHT_SHORT_LENGTH}"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user