mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-06-10 16:43:09 +00:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2daab132aa | ||
|
|
26c5c6b51c | ||
|
|
4a00c29bc1 | ||
|
|
c0fb0bc1a5 | ||
|
|
60beba5b25 | ||
|
|
7bf92d88ff | ||
|
|
ae2f6b069b | ||
|
|
7c02e68015 | ||
|
|
5150a26d43 | ||
|
|
dedf4ac5bb | ||
|
|
ebfc49c0e9 | ||
|
|
68babf69b3 | ||
|
|
1bf76b7bc6 | ||
|
|
46a738e36b | ||
|
|
82da1fd43c | ||
|
|
99afdf4551 | ||
|
|
944fee4603 | ||
|
|
19f9c84ac6 | ||
|
|
596b602d8a | ||
|
|
b98d94bda3 | ||
|
|
e8c1f6060b | ||
|
|
f80aa0fae4 | ||
|
|
046be07299 | ||
|
|
38b80287e3 | ||
|
|
c559dac9da | ||
|
|
2f05f8b5cb | ||
|
|
9f53b89c13 |
184
.github/workflows/build-os-dependent.yml
vendored
184
.github/workflows/build-os-dependent.yml
vendored
@@ -1,184 +0,0 @@
|
|||||||
name: Build OS-Dependent
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- v3.x
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- v3.x
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
use-on-linux:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: technote-space/auto-cancel-redundant-workflow@v1
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run all
|
|
||||||
- uses: ./
|
|
||||||
- name: Output
|
|
||||||
run: |
|
|
||||||
echo "Partial variables"
|
|
||||||
echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART }}"
|
|
||||||
echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART }}"
|
|
||||||
echo "Slug variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Slug URL variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Short SHA variables"
|
|
||||||
echo " sha : ${{ env.GITHUB_SHA_SHORT }}"
|
|
||||||
echo " pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}"
|
|
||||||
echo "Branch Name"
|
|
||||||
echo " raw : ${{ env.GITHUB_BRANCH_NAME }}"
|
|
||||||
echo " slug : ${{ env.GITHUB_BRANCH_NAME_SLUG }}"
|
|
||||||
echo " slug url : ${{ env.GITHUB_BRANCH_NAME_SLUG_URL }}"
|
|
||||||
- name: Case Sensitive Output
|
|
||||||
run: |
|
|
||||||
echo "Slug variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Slug URL variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Branch Name"
|
|
||||||
echo " slug : ${{ env.GITHUB_BRANCH_NAME_SLUG_CS }}"
|
|
||||||
echo " slug url : ${{ env.GITHUB_BRANCH_NAME_SLUG_URL_CS }}"
|
|
||||||
|
|
||||||
use-on-macos:
|
|
||||||
runs-on: macos-latest
|
|
||||||
steps:
|
|
||||||
- uses: technote-space/auto-cancel-redundant-workflow@v1
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run all
|
|
||||||
- uses: ./
|
|
||||||
- name: Output
|
|
||||||
run: |
|
|
||||||
echo "Partial variables"
|
|
||||||
echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART }}"
|
|
||||||
echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART }}"
|
|
||||||
echo "Slug variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Slug URL variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Short SHA variables"
|
|
||||||
echo " sha : ${{ env.GITHUB_SHA_SHORT }}"
|
|
||||||
echo " pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}"
|
|
||||||
echo "Branch Name"
|
|
||||||
echo " raw : ${{ env.GITHUB_BRANCH_NAME }}"
|
|
||||||
echo " slug : ${{ env.GITHUB_BRANCH_NAME_SLUG }}"
|
|
||||||
echo " slug url : ${{ env.GITHUB_BRANCH_NAME_SLUG_URL }}"
|
|
||||||
- name: Case Sensitive Output
|
|
||||||
run: |
|
|
||||||
echo "Slug variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Slug URL variables"
|
|
||||||
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 }}"
|
|
||||||
echo "Branch Name"
|
|
||||||
echo " slug : ${{ env.GITHUB_BRANCH_NAME_SLUG_CS }}"
|
|
||||||
echo " slug url : ${{ env.GITHUB_BRANCH_NAME_SLUG_URL_CS }}"
|
|
||||||
|
|
||||||
use-on-windows:
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- uses: technote-space/auto-cancel-redundant-workflow@v1
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run all
|
|
||||||
- uses: ./
|
|
||||||
- name: Output
|
|
||||||
run: |
|
|
||||||
echo "Partial variables"
|
|
||||||
echo " repository owner : $env:GITHUB_REPOSITORY_OWNER_PART"
|
|
||||||
echo " repository name : $env:GITHUB_REPOSITORY_NAME_PART"
|
|
||||||
echo "Slug variables"
|
|
||||||
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"
|
|
||||||
echo "Slug URL variables"
|
|
||||||
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"
|
|
||||||
echo "Short SHA variables"
|
|
||||||
echo " sha : $env:GITHUB_SHA_SHORT"
|
|
||||||
echo " pull request sha : $env:GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT"
|
|
||||||
echo "Branch Name"
|
|
||||||
echo " raw : $env:GITHUB_BRANCH_NAME"
|
|
||||||
echo " slug : $env:GITHUB_BRANCH_NAME_SLUG"
|
|
||||||
echo " slug url : $env:GITHUB_BRANCH_NAME_SLUG_URL"
|
|
||||||
- name: Case Sensitive Output
|
|
||||||
run: |
|
|
||||||
echo "Slug variables"
|
|
||||||
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"
|
|
||||||
echo "Slug URL variables"
|
|
||||||
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"
|
|
||||||
echo "Branch Name"
|
|
||||||
echo " slug : $env:GITHUB_BRANCH_NAME_SLUG_CS"
|
|
||||||
echo " slug url : $env:GITHUB_BRANCH_NAME_SLUG_URL_CS"
|
|
||||||
19
.github/workflows/codeql-analysis.yml
vendored
19
.github/workflows/codeql-analysis.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: CodeQL
|
name: '[v3] CodeQL'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,7 +8,11 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- v3.x
|
- v3.x
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 6 * * 1"
|
- cron: '0 6 * * 1'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyse:
|
analyse:
|
||||||
@@ -17,12 +21,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: ["javascript"]
|
language: ['javascript']
|
||||||
steps:
|
steps:
|
||||||
- uses: technote-space/auto-cancel-redundant-workflow@v1
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/checkout@v2
|
- uses: github/codeql-action/init@v2
|
||||||
- uses: github/codeql-action/init@v1
|
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
- uses: github/codeql-action/autobuild@v1
|
- uses: github/codeql-action/autobuild@v2
|
||||||
- uses: github/codeql-action/analyze@v1
|
- uses: github/codeql-action/analyze@v2
|
||||||
|
|||||||
74
.github/workflows/github-slug.yml
vendored
Normal file
74
.github/workflows/github-slug.yml
vendored
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
name: '[v3] Testing'
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
github-slug-on-os:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- run: npm install
|
||||||
|
shell: bash
|
||||||
|
- run: npm run all
|
||||||
|
shell: bash
|
||||||
|
- 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 }}"
|
||||||
|
- 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
|
||||||
31
.github/workflows/linter.yml
vendored
31
.github/workflows/linter.yml
vendored
@@ -1,31 +0,0 @@
|
|||||||
name: Lint
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- v3.x
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- v3.x
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: technote-space/auto-cancel-redundant-workflow@v1
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: github/super-linter@v3
|
|
||||||
env:
|
|
||||||
VALIDATE_ALL_CODEBASE: false
|
|
||||||
VALIDATE_JAVASCRIPT_STANDARD: false
|
|
||||||
VALIDATE_TYPESCRIPT_STANDARD: false
|
|
||||||
LINTER_RULES_PATH: .
|
|
||||||
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
|
|
||||||
JAVASCRIPT_DEFAULT_STYLE: prettier
|
|
||||||
DEFAULT_BRANCH: v3.x
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
FILTER_REGEX_INCLUDE: .*src/.*
|
|
||||||
12
.github/workflows/release-dryrun.yml
vendored
12
.github/workflows/release-dryrun.yml
vendored
@@ -1,20 +1,24 @@
|
|||||||
name: Release DryRun
|
name: '[v3] Release DryRun'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- v*.x
|
- v*.x
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release-dryrun:
|
release-dryrun:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: technote-space/auto-cancel-redundant-workflow@v1
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: npm install
|
- run: npm install
|
||||||
|
shell: bash
|
||||||
- run: npm run all
|
- run: npm run all
|
||||||
|
shell: bash
|
||||||
- uses: ./
|
- uses: ./
|
||||||
- uses: cycjimmy/semantic-release-action@v2
|
- uses: cycjimmy/semantic-release-action@v3
|
||||||
with:
|
with:
|
||||||
branches: |
|
branches: |
|
||||||
[
|
[
|
||||||
|
|||||||
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@@ -1,18 +1,22 @@
|
|||||||
name: Release
|
name: '[v3] Release'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- v*.x
|
- v*.x
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: technote-space/auto-cancel-redundant-workflow@v1
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: npm install
|
- run: npm install
|
||||||
|
shell: bash
|
||||||
- run: npm run all
|
- run: npm run all
|
||||||
- uses: cycjimmy/semantic-release-action@v2
|
shell: bash
|
||||||
|
- uses: cycjimmy/semantic-release-action@v3
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
35
CHANGELOG.md
35
CHANGELOG.md
@@ -1,3 +1,38 @@
|
|||||||
|
# [3.9.0](https://github.com/rlespinasse/github-slug-action/compare/v3.8.0...v3.9.0) (2024-01-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* use node20 as action run mode ([#138](https://github.com/rlespinasse/github-slug-action/issues/138)) ([26c5c6b](https://github.com/rlespinasse/github-slug-action/commit/26c5c6b51cfc01c811f8a14ddd9d9bcb43948328))
|
||||||
|
|
||||||
|
# [3.8.0](https://github.com/rlespinasse/github-slug-action/compare/v3.7.1...v3.8.0) (2023-10-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* use node16 as action run mode ([7bf92d8](https://github.com/rlespinasse/github-slug-action/commit/7bf92d88ffb302024ab1f11ced51360f041f1b5e))
|
||||||
|
|
||||||
|
## [3.7.1](https://github.com/rlespinasse/github-slug-action/compare/v3.7.0...v3.7.1) (2022-10-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* use environment file to manage outputs ([dedf4ac](https://github.com/rlespinasse/github-slug-action/commit/dedf4ac5bbb50aeb6992c8323d2862843079f1b4))
|
||||||
|
|
||||||
|
# [3.7.0](https://github.com/rlespinasse/github-slug-action/compare/v3.6.1...v3.7.0) (2022-10-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* generate proper git tag ([68babf6](https://github.com/rlespinasse/github-slug-action/commit/68babf69b34f4c4b556ea350616c5408d627937e))
|
||||||
|
|
||||||
|
## [3.6.1](https://github.com/rlespinasse/github-slug-action/compare/3.6.0...3.6.1) (2022-08-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* remove trailing hyphens if any after cut ([19f9c84](https://github.com/rlespinasse/github-slug-action/commit/19f9c84ac61b17071a3cfc4ae984ac0e2ba1cdae))
|
||||||
|
|
||||||
# [3.6.0](http://github.com/rlespinasse/github-slug-action/compare/3.5.1...3.6.0) (2021-09-15)
|
# [3.6.0](http://github.com/rlespinasse/github-slug-action/compare/3.5.1...3.6.0) (2021-09-15)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
74
README.md
74
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
|
||||||
|
|
||||||
@@ -21,6 +17,8 @@ This GitHub Action will expose the slug/short values of [some GitHub environment
|
|||||||
- [Contribute](#contribute)
|
- [Contribute](#contribute)
|
||||||
- [Troubleshooting](#troubleshooting)
|
- [Troubleshooting](#troubleshooting)
|
||||||
- [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)
|
||||||
|
|
||||||
@@ -30,8 +28,9 @@ 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>
|
||||||
@@ -126,34 +125,42 @@ Follow [Developers guide](DEVELOPERS.md)
|
|||||||
|
|
||||||
### 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 available in `v4` version
|
||||||
|
|
||||||
```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/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"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
</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
|
||||||
|
|
||||||
@@ -174,23 +181,22 @@ Please, use the current branch `v3.x` or a version tag (see [releases pages][rel
|
|||||||
|
|
||||||
- [Mettre en place une CI/CD Angular avec GitHub Actions & Netlify][article-1] (in french :fr:)
|
- [Mettre en place une CI/CD Angular avec GitHub Actions & Netlify][article-1] (in french :fr:)
|
||||||
- [Github Actions : enfin des pipelines accessibles aux développeurs][talk-1] (in french :fr:)
|
- [Github Actions : enfin des pipelines accessibles aux développeurs][talk-1] (in french :fr:)
|
||||||
|
- [Action spotlight by Michael Heap][article-2]
|
||||||
- The next one is you. _Don't hesitate to add youself to this list._
|
- The next one is you. _Don't hesitate to add youself to this list._
|
||||||
|
|
||||||
[release-badge]: https://img.shields.io/github/workflow/status/rlespinasse/github-slug-action/Release?label=Build&logo=github&style=flat-square
|
|
||||||
[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
|
|
||||||
|
|
||||||
[actions]: https://github.com/rlespinasse/github-slug-action/actions
|
[actions]: https://github.com/rlespinasse/github-slug-action/actions
|
||||||
[license]: https://github.com/rlespinasse/github-slug-action/blob/v3.x/LICENSE
|
[license]: https://github.com/rlespinasse/github-slug-action/blob/v3.x/LICENSE
|
||||||
[examples]: https://github.com/rlespinasse/github-slug-action/tree/v3.x/examples
|
[examples]: https://github.com/rlespinasse/github-slug-action/tree/v3.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
|
[default-environment-variables]: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
|
||||||
[dependabot]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot
|
[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/
|
||||||
[talk-1]: https://www.youtube.com/watch?v=RHnTJBwcE98
|
[talk-1]: https://www.youtube.com/watch?v=RHnTJBwcE98
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ test('slug: a number', () => {
|
|||||||
test_slug_cs('4.2', '4.2')
|
test_slug_cs('4.2', '4.2')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('slug: an underscore', () => {
|
||||||
|
test_slug('An_Underscore', 'an_underscore')
|
||||||
|
test_slug_cs('An_Underscore', 'An_Underscore')
|
||||||
|
})
|
||||||
|
|
||||||
test('slug: special character', () => {
|
test('slug: special character', () => {
|
||||||
test_slug('feat-(!è§-character', 'feat------character')
|
test_slug('feat-(!è§-character', 'feat------character')
|
||||||
test_slug_cs('feat-(!è§-character', 'feat------character')
|
test_slug_cs('feat-(!è§-character', 'feat------character')
|
||||||
@@ -47,22 +52,22 @@ test('slug: trailing', () => {
|
|||||||
|
|
||||||
test('slug: a very long string', () => {
|
test('slug: a very long string', () => {
|
||||||
test_slug(
|
test_slug(
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-feature-very-very-very-very-very-very-very-long-more'
|
'has-an-awesome-feature-very-very-very-very-very-very-very-long'
|
||||||
)
|
)
|
||||||
test_slug_cs(
|
test_slug_cs(
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-more'
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('slug: short string after trailing', () => {
|
test('slug: short string after trailing', () => {
|
||||||
test_slug(
|
test_slug(
|
||||||
'-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters-',
|
'-has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters-',
|
||||||
'an-awesome-feature-very-very-very-very-very-very-very-long-more'
|
'has-an-awesome-feature-very-very-very-very-very-very-very-long'
|
||||||
)
|
)
|
||||||
test_slug_cs(
|
test_slug_cs(
|
||||||
'-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters-',
|
'-has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters-',
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-more'
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ test('slug_ref: a fix branch', () => {
|
|||||||
test_slugref_cs('refs/heads/fix/issue_number', 'fix-issue_number')
|
test_slugref_cs('refs/heads/fix/issue_number', 'fix-issue_number')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('slug_ref: an underscore', () => {
|
||||||
|
test_slugref('refs/heads/An_Underscore', 'an_underscore')
|
||||||
|
test_slugref_cs('refs/heads/An_Underscore', 'An_Underscore')
|
||||||
|
})
|
||||||
|
|
||||||
test('slug_ref: a simple tag', () => {
|
test('slug_ref: a simple tag', () => {
|
||||||
test_slugref('refs/tags/v1.0.0', 'v1.0.0')
|
test_slugref('refs/tags/v1.0.0', 'v1.0.0')
|
||||||
test_slugref_cs('refs/tags/v1.0.0', 'v1.0.0')
|
test_slugref_cs('refs/tags/v1.0.0', 'v1.0.0')
|
||||||
@@ -52,12 +57,12 @@ test('slug_ref: test refs inside string', () => {
|
|||||||
|
|
||||||
test('slug_ref: a very long name', () => {
|
test('slug_ref: a very long name', () => {
|
||||||
test_slugref(
|
test_slugref(
|
||||||
'refs/heads/an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'refs/heads/has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-feature-very-very-very-very-very-very-very-long-more'
|
'has-an-awesome-feature-very-very-very-very-very-very-very-long'
|
||||||
)
|
)
|
||||||
test_slugref_cs(
|
test_slugref_cs(
|
||||||
'refs/heads/an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'refs/heads/has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-more'
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ test('slug_url: a number', () => {
|
|||||||
test_slugurl_cs('4.2', '4-2')
|
test_slugurl_cs('4.2', '4-2')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('slug_url: an underscore', () => {
|
||||||
|
test_slugurl('An_Underscore', 'an-underscore')
|
||||||
|
test_slugurl_cs('An_Underscore', 'An-Underscore')
|
||||||
|
})
|
||||||
|
|
||||||
test('slug_url: trailing', () => {
|
test('slug_url: trailing', () => {
|
||||||
test_slugurl('.path.to.', 'path-to')
|
test_slugurl('.path.to.', 'path-to')
|
||||||
test_slugurl_cs('.path.to.', 'path-to')
|
test_slugurl_cs('.path.to.', 'path-to')
|
||||||
@@ -42,11 +47,11 @@ test('slug_url: trailing', () => {
|
|||||||
|
|
||||||
test('slug_url: a very long string', () => {
|
test('slug_url: a very long string', () => {
|
||||||
test_slugurl(
|
test_slugurl(
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-feature-very-very-very-very-very-very-very-long-more'
|
'has-an-awesome-feature-very-very-very-very-very-very-very-long'
|
||||||
)
|
)
|
||||||
test_slugurl_cs(
|
test_slugurl_cs(
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-more'
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ test('slug_url_ref: a fix branch', () => {
|
|||||||
test_slugurlref_cs('refs/heads/fix/issue_number', 'fix-issue-number')
|
test_slugurlref_cs('refs/heads/fix/issue_number', 'fix-issue-number')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('slug_url_ref: an underscore', () => {
|
||||||
|
test_slugurlref('refs/heads/An_Underscore', 'an-underscore')
|
||||||
|
test_slugurlref_cs('refs/heads/An_Underscore', 'An-Underscore')
|
||||||
|
})
|
||||||
|
|
||||||
test('slug_url_ref: a simple tag', () => {
|
test('slug_url_ref: a simple tag', () => {
|
||||||
test_slugurlref('refs/tags/v1.0.0', 'v1-0-0')
|
test_slugurlref('refs/tags/v1.0.0', 'v1-0-0')
|
||||||
test_slugurlref_cs('refs/tags/v1.0.0', 'v1-0-0')
|
test_slugurlref_cs('refs/tags/v1.0.0', 'v1-0-0')
|
||||||
@@ -42,12 +47,12 @@ test('slug_url_ref: a reference with upper case letters', () => {
|
|||||||
|
|
||||||
test('slug_url_ref: a very long name', () => {
|
test('slug_url_ref: a very long name', () => {
|
||||||
test_slugurlref(
|
test_slugurlref(
|
||||||
'refs/heads/an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'refs/heads/has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-feature-very-very-very-very-very-very-very-long-more'
|
'has-an-awesome-feature-very-very-very-very-very-very-very-long'
|
||||||
)
|
)
|
||||||
test_slugurlref_cs(
|
test_slugurlref_cs(
|
||||||
'refs/heads/an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
'refs/heads/has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-moreThan63Characters',
|
||||||
'an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long-more'
|
'has-an-awesome-Feature-Very-Very-Very-Very-Very-Very-Very-Long'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
10
action.yml
10
action.yml
@@ -1,9 +1,9 @@
|
|||||||
name: "GitHub Slug Action"
|
name: 'GitHub Slug Action'
|
||||||
description: "GitHub Action to expose slug value of environment variables inside your GitHub workflow"
|
description: 'GitHub Action to expose slug value of environment variables inside your GitHub workflow'
|
||||||
author: 'rlespinasse'
|
author: 'rlespinasse'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
branding:
|
branding:
|
||||||
icon: "minimize"
|
icon: 'minimize'
|
||||||
color: "blue"
|
color: 'blue'
|
||||||
|
|||||||
3368
dist/index.js
vendored
3368
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
3913
dist/sourcemap-register.js
vendored
3913
dist/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: rlespinasse/github-slug-action@v3.x
|
- uses: rlespinasse/github-slug-action@v3.x
|
||||||
- run: |
|
- run: |
|
||||||
./deploy-application.sh --url "https://${{ env.GITHUB_REF_SLUG_URL }}.staging.app.mycompany.com"
|
./deploy-application.sh --url "https://${{ env.GITHUB_REF_SLUG_URL }}.staging.app.example.com"
|
||||||
|
|
||||||
as_resource_path:
|
as_resource_path:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -17,4 +17,4 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: rlespinasse/github-slug-action@v3.x
|
- uses: rlespinasse/github-slug-action@v3.x
|
||||||
- run: |
|
- run: |
|
||||||
./deploy-application.sh --url "https://staging.app.mycompany.com/${{ env.GITHUB_REF_SLUG_URL }}"
|
./deploy-application.sh --url "https://staging.app.example.com/${{ env.GITHUB_REF_SLUG_URL }}"
|
||||||
|
|||||||
17098
package-lock.json
generated
17098
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
33
package.json
33
package.json
@@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "http://github.com/rlespinasse/github-slug-action.git"
|
"url": "https://github.com/rlespinasse/github-slug-action.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
@@ -26,32 +26,32 @@
|
|||||||
],
|
],
|
||||||
"author": "rlespinasse",
|
"author": "rlespinasse",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6"
|
"@actions/core": "^1.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@semantic-release/changelog": "^5.0.1",
|
"@semantic-release/changelog": "^6.0.1",
|
||||||
"@semantic-release/exec": "^5.0.0",
|
"@semantic-release/exec": "^6.0.0",
|
||||||
"@semantic-release/git": "^9.0.0",
|
"@semantic-release/git": "^10.0.1",
|
||||||
"@types/jest": "^26.0.20",
|
"@types/jest": "^26.0.24",
|
||||||
"@types/node": "^14.14.21",
|
"@types/node": "^14.18.25",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
||||||
"@vercel/ncc": "^0.23.0",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^7.18.0",
|
"eslint": "^8.0.1",
|
||||||
"eslint-plugin-github": "^4.1.1",
|
"eslint-plugin-github": "^4.3.7",
|
||||||
"eslint-plugin-jest": "^23.20.0",
|
"eslint-plugin-jest": "^23.20.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"jest-circus": "^26.6.3",
|
"jest-circus": "^26.6.3",
|
||||||
"js-yaml": "^3.14.1",
|
"js-yaml": "^3.14.1",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.7.1",
|
||||||
"semantic-release": "^17.4.0",
|
"semantic-release": "^19.0.3",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.5.6",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^4.2.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"/dist"
|
"/dist"
|
||||||
],
|
],
|
||||||
"release": {
|
"release": {
|
||||||
"tagFormat": "${version}",
|
"tagFormat": "v${version}",
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@semantic-release/commit-analyzer",
|
"@semantic-release/commit-analyzer",
|
||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
@@ -66,7 +66,6 @@
|
|||||||
"@semantic-release/github"
|
"@semantic-release/github"
|
||||||
],
|
],
|
||||||
"branches": [
|
"branches": [
|
||||||
"v2.x",
|
|
||||||
"v3.x"
|
"v3.x"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
exportBranchName()
|
exportBranchName()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
if (error instanceof Error) core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
45
src/slug.ts
45
src/slug.ts
@@ -3,14 +3,17 @@ const MAX_SLUG_STRING_SIZE = 63
|
|||||||
/**
|
/**
|
||||||
* slug_cs will take envVar and then :
|
* slug_cs will take envVar and then :
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slug_cs(envVar: string): string {
|
export function slug_cs(envVar: string): string {
|
||||||
return trailHyphen(replaceAnyNonAlphanumericCharacter(envVar)).substring(
|
return removeTrailingHyphens(
|
||||||
0,
|
removeLeadingHyphens(replaceAnyNonAlphanumericCharacter(envVar)).substring(
|
||||||
MAX_SLUG_STRING_SIZE
|
0,
|
||||||
|
MAX_SLUG_STRING_SIZE
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,8 +21,9 @@ export function slug_cs(envVar: string): string {
|
|||||||
* slug will take envVar and then :
|
* slug will take envVar and then :
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slug(envVar: string): string {
|
export function slug(envVar: string): string {
|
||||||
@@ -30,8 +34,9 @@ export function slug(envVar: string): string {
|
|||||||
* slugref_cs will take envVar and then :
|
* slugref_cs will take envVar and then :
|
||||||
* - remove refs/(heads|tags|pull)/
|
* - remove refs/(heads|tags|pull)/
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slugref_cs(envVar: string): string {
|
export function slugref_cs(envVar: string): string {
|
||||||
@@ -43,8 +48,9 @@ export function slugref_cs(envVar: string): string {
|
|||||||
* - remove refs/(heads|tags|pull)/
|
* - remove refs/(heads|tags|pull)/
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slugref(envVar: string): string {
|
export function slugref(envVar: string): string {
|
||||||
@@ -54,8 +60,9 @@ export function slugref(envVar: string): string {
|
|||||||
/**
|
/**
|
||||||
* slugurl_cs will take envVar and then :
|
* slugurl_cs will take envVar and then :
|
||||||
* - replace any character by `-` except `0-9`, `a-z`
|
* - replace any character by `-` except `0-9`, `a-z`
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slugurl_cs(envVar: string): string {
|
export function slugurl_cs(envVar: string): string {
|
||||||
@@ -66,24 +73,26 @@ export function slugurl_cs(envVar: string): string {
|
|||||||
* slugurl will take envVar and then :
|
* slugurl will take envVar and then :
|
||||||
* - put the variable content in lower case
|
* - put the variable content in lower case
|
||||||
* - replace any character by `-` except `0-9`, `a-z`
|
* - replace any character by `-` except `0-9`, `a-z`
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slugurl(envVar: string): string {
|
export function slugurl(envVar: string): string {
|
||||||
return slug(replaceAnyNonUrlCharactersWithHyphen(envVar))
|
return slugurl_cs(envVar.toLowerCase())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* slugurlref_cs will take envVar and then :
|
* slugurlref_cs will take envVar and then :
|
||||||
* - remove refs/(heads|tags|pull)/
|
* - remove refs/(heads|tags|pull)/
|
||||||
* - replace any character by `-` except `0-9`, `a-z`
|
* - replace any character by `-` except `0-9`, `a-z`
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slugurlref_cs(envVar: string): string {
|
export function slugurlref_cs(envVar: string): string {
|
||||||
return slugurl_cs(slugref_cs(envVar))
|
return slugurl_cs(removeRef(envVar))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,16 +100,20 @@ export function slugurlref_cs(envVar: string): string {
|
|||||||
* - remove refs/(heads|tags|pull)/
|
* - remove refs/(heads|tags|pull)/
|
||||||
* - put the variable content in lower case
|
* - put the variable content in lower case
|
||||||
* - replace any character by `-` except `0-9`, `a-z`
|
* - replace any character by `-` except `0-9`, `a-z`
|
||||||
* - 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
|
||||||
* @param envVar to be slugged
|
* @param envVar to be slugged
|
||||||
*/
|
*/
|
||||||
export function slugurlref(envVar: string): string {
|
export function slugurlref(envVar: string): string {
|
||||||
return slugurl(slugref(envVar))
|
return slugurlref_cs(envVar.toLowerCase())
|
||||||
}
|
}
|
||||||
|
|
||||||
function trailHyphen(envVar: string): string {
|
function removeLeadingHyphens(envVar: string): string {
|
||||||
return envVar.replace(RegExp('^-*', 'g'), '').replace(RegExp('-*$', 'g'), '')
|
return envVar.replace(RegExp('^-*', 'g'), '')
|
||||||
|
}
|
||||||
|
function removeTrailingHyphens(envVar: string): string {
|
||||||
|
return envVar.replace(RegExp('-*$', 'g'), '')
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceAnyNonAlphanumericCharacter(envVar: string): string {
|
function replaceAnyNonAlphanumericCharacter(envVar: string): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user