Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tonye Jack committed Dec 11, 2020
0 parents commit c5308c6
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
.envrc
Empty file added CONTRIBUTING.md
Empty file.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
History
-------

v1 (2020-12-11)
------------------

* Initial Release.
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 27 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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\//}"

0 comments on commit c5308c6

Please sign in to comment.