Skip to content

Commit

Permalink
init action
Browse files Browse the repository at this point in the history
  • Loading branch information
InsonusK committed Aug 20, 2020
1 parent 96e78de commit 111eac1
Show file tree
Hide file tree
Showing 7 changed files with 6,381 additions and 0 deletions.
152 changes: 152 additions & 0 deletions .github/workflows/UnitTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: JS Actions

on: [push, release]

jobs:
get_draft:
name: "Get draft release from all releases"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: "call action"
id: last_release
uses: ./
with:
myToken: ${{ github.token }}
- name: "Print result"
run: |
echo "id: ${{ steps.last_release.outputs.id }}"
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}"
echo "created_at: ${{ steps.last_release.outputs.created_atd }}"
echo "draft: ${{ steps.last_release.outputs.draft }}"
echo "prerelease: ${{ steps.last_release.outputs.prerelease }}"
- name: "Assert"
run: |
if [[ "${{ steps.last_release.outputs.id }}" == "" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.draft }}" != "true" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.prerelease }}" != "false" ]];
then
echo "Wrong release type"
exit 4
fi
get_prerelease:
name: "Get prerelease release from all releases"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: "call action"
id: last_release
uses: ./
with:
myToken: ${{ github.token }}
exclude_types: "draft"
- name: "Print result"
run: |
echo "id: ${{ steps.last_release.outputs.id }}"
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}"
echo "created_at: ${{ steps.last_release.outputs.created_atd }}"
echo "draft: ${{ steps.last_release.outputs.draft }}"
echo "prerelease: ${{ steps.last_release.outputs.prerelease }}"
- name: "Assert"
run: |
if [[ "${{ steps.last_release.outputs.id }}" == "" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.draft }}" != "false" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.prerelease }}" != "true" ]];
then
echo "Wrong release type"
exit 4
fi
get_release:
name: "Get release release from all releases"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: "call action"
id: last_release
uses: ./
with:
myToken: ${{ github.token }}
exclude_types: "draft|prerelease"
- name: "Print result"
run: |
echo "id: ${{ steps.last_release.outputs.id }}"
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}"
echo "created_at: ${{ steps.last_release.outputs.created_atd }}"
echo "draft: ${{ steps.last_release.outputs.draft }}"
echo "prerelease: ${{ steps.last_release.outputs.prerelease }}"
- name: "Assert"
run: |
if [[ "${{ steps.last_release.outputs.id }}" == "" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.draft }}" != "false" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.prerelease }}" != "false" ]];
then
echo "Wrong release type"
exit 4
fi
get_zero_because_of_top_list_limit:
name: "Get no release because draft is canceled and limit is set to 1"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: "call action"
id: last_release
uses: ./
with:
myToken: ${{ github.token }}
exclude_types: "draft"
view_top: 1
- name: "Print result"
run: |
echo "id: ${{ steps.last_release.outputs.id }}"
echo "tag_name: ${{ steps.last_release.outputs.tag_name }}"
echo "created_at: ${{ steps.last_release.outputs.created_atd }}"
echo "draft: ${{ steps.last_release.outputs.draft }}"
echo "prerelease: ${{ steps.last_release.outputs.prerelease }}"
- name: "Assert"
run: |
if [[ "${{ steps.last_release.outputs.id }}" != "" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.draft }}" != "" ]];
then
echo "Wrong release type"
exit 4
fi
if [[ "${{ steps.last_release.outputs.prerelease }}" != "" ]];
then
echo "Wrong release type"
exit 4
fi
28 changes: 28 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "toolkit test"

description: "js action that use github toolkit"
inputs:
myToken:
description: "GitHub Token"
required: true
exclude_types:
description: "Exclude release type (example: draft|prerelease)"
required: false
view_top:
description: "View top releases to find release"
required: false
default: 100
outputs:
id:
description: 'Id of the release'
tag_name:
description: 'Tag of the release'
created_at:
description: 'Creation date of the release'
draft:
description: 'Release is draft'
prerelease:
description: 'Release is prerelease'
runs:
using: "node12"
main: "dist/index.js"
Loading

0 comments on commit 111eac1

Please sign in to comment.