mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-09-18 08:37:22 +00:00
feat: expose GITHUB_REF_SLUG
This commit is contained in:
8
Dockerfile
Normal file
8
Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
||||
# Container image that runs your code
|
||||
FROM alpine:3.10
|
||||
|
||||
# Copies your code file from your action repository to the filesystem path `/` of the container
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
# Code file to execute when the docker container starts up (`entrypoint.sh`)
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
21
README.md
Normal file
21
README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# GitHub Slug action
|
||||
|
||||
This action slug and expose some github variables.
|
||||
|
||||
`Slug` a variable will
|
||||
|
||||
- put the variable content in lower case,
|
||||
- replace any caracter by `-` except `0-9` and `a-z`,
|
||||
- limit the string size to 63 caracter
|
||||
|
||||
## Environement Variables
|
||||
|
||||
### `GITHUB_REF_SLUG`
|
||||
|
||||
Slug from `GITHUB_REF` env variables
|
||||
|
||||
## Example usage
|
||||
|
||||
```yaml
|
||||
uses: rlespinasse/github-slug-action@master
|
||||
```
|
||||
6
action.yml
Normal file
6
action.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
# action.yml
|
||||
name: 'GitHub Slug'
|
||||
description: 'Action to slug and expose some github variables'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
3
entrypoint.sh
Executable file
3
entrypoint.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh -l
|
||||
|
||||
echo ::set-env name=GITHUB_REF_SLUG::$(echo $GITHUB_REF | tr A-Z a-z | sed -r 's#refs/.*/##;s/[~\^]+//g;s/[^a-zA-Z0-9]+/-/g;s/^-+\|-+$//g' | cut -c1-63)
|
||||
Reference in New Issue
Block a user