Initial commit.

This commit is contained in:
Tonye Jack 2020-12-11 08:15:40 -05:00
commit c5308c6d98
10 changed files with 150 additions and 0 deletions

10
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,10 @@
* branch-name:
### Description
Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
### What I Did
Add some details about your workflow ?

19
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
name: Test branch-name
steps:
- name: Checkout
uses: actions/checkout@v2
- name: shellcheck
uses: reviewdog/action-shellcheck@v1

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea/
.envrc

0
CONTRIBUTING.md Normal file
View File

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM alpine:3.12
LABEL maintainer="Tonye Jack <jtonye@ymail.com>"
RUN apk add bash
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

7
HISTORY.md Normal file
View File

@ -0,0 +1,7 @@
History
-------
v1 (2020-12-11)
------------------
* Initial Release.

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2020, Tonye Jack
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

47
README.md Normal file
View File

@ -0,0 +1,47 @@
branch-name
-----------
Retrieve giithub branch information without any prefix
```yaml
...
steps:
- uses: actions/checkout@v2
- name: Get branch name
uses: tj-actions/branch-name@v1
```
## Inputs
| Input | type | required | default |
|:-------------:|:-----------:|:-------------:|:---------------------:|
| token | `string` | `false` | `${{ github.token }}` |
* Free software: [MIT license](LICENSE)
Features
--------
* TODO
Credits
-------
This package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter).
Report Bugs
-----------
Report bugs at https://github.com/tj-actions/branch-name/issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your workflow that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

27
action.yml Normal file
View File

@ -0,0 +1,27 @@
name: Get branch name
description: Retrieve giithub branch information without `/ref/heads` prefix
author: tj-actions
inputs:
token:
description: 'GITHUB_TOKEN or a Repo scoped PAT'
required: true
default: ${{ github.token }}
outputs:
base_ref_branch:
description: 'The target branch of a pull request'
head_ref_branch:
description: 'The source branch of a pull request'
ref_branch:
description: 'The branch that triggered the workflow run.'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ github.base_ref }}
- ${{ github.head_ref }}
- ${{ github.ref }}
branding:
icon: git-branch
color: white

7
entrypoint.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
echo "::set-output name=base_ref_branch::${0/refs\/heads\//}"
echo "::set-output name=head_ref_branch::${1/refs\/heads\//}"
echo "::set-output name=ref_branch::${2/refs\/heads\//}"