Skip to content

Commit

Permalink
Merge branch 'main' into feature/add-support-for-formatting-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed May 27, 2021
2 parents d71d3e7 + d251958 commit 0183e3b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,53 @@ jobs:
echo "Ref: ${{ steps.branch-name.outputs.ref_branch }}"
echo "Is Default: ${{ steps.branch-name.outputs.is_default }}"
echo "Current tag: ${{ steps.branch-name.outputs.tag }}"
- name: Check is_default for pull request
if: github.event_name == 'pull_request' && !startsWith(github.ref, 'refs/tags/') && steps.branch-name.outputs.is_default != 'false'
- name: Test is_default output for pull request
if: github.event_name == 'pull_request' && steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default != 'false'
run: |
echo "Is default is invalid: ${{ steps.branch-name.outputs.is_default }}"
exit 1
- name: Check is_default for non pull request
if: github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/tags/') && steps.branch-name.outputs.is_default != 'true'
- name: Test is_default output for non pull request
if: github.event_name != 'pull_request' && steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default != 'true'
run: |
echo "Is default is invalid: ${{ steps.branch-name.outputs.is_default }}"
exit 1
- name: Test base ref output
if: github.event_name == 'pull_request' && !startsWith(github.ref, 'refs/tags/') && !steps.branch-name.outputs.base_ref_branch
- name: Test base_ref_branch output
if: github.event_name == 'pull_request' && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.base_ref_branch
run: |
echo "Base ref unset: ${{ steps.branch-name.outputs.base_ref_branch }}"
exit 1
- name: Test head ref output
if: github.event_name == 'pull_request' && !startsWith(github.ref, 'refs/tags/') && !steps.branch-name.outputs.head_ref_branch
- name: Test head_ref output
if: github.event_name == 'pull_request' && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.head_ref_branch
run: |
echo "Head ref unset: ${{ steps.branch-name.outputs.head_ref_branch }}"
exit 1
- name: Test ref output
if: "!steps.branch-name.outputs.ref_branch && !startsWith(github.ref, 'refs/tags/') "
- name: Test ref_branch output
if: "!steps.branch-name.outputs.ref_branch && steps.branch-name.outputs.is_tag == 'false'"
run: |
echo "Ref unset: ${{ steps.branch-name.outputs.ref_branch }}"
exit 1
- name: Test current branch output for pull_request event.
if: github.event_name == 'pull_request' && !startsWith(github.ref, 'refs/tags/') && !steps.branch-name.outputs.current_branch
- name: Test current_branch output for pull_request event.
if: github.event_name == 'pull_request' && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.current_branch
run: |
echo "Current branch unset: ${{ steps.branch-name.outputs.current_branch }}"
exit 1
- name: Test current branch output for push event.
if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') && !steps.branch-name.outputs.current_branch
- name: Test current_branch output for push event.
if: github.event_name == 'push' && steps.branch-name.outputs.is_tag == 'false' && !steps.branch-name.outputs.current_branch
run: |
echo "Current branch unset: ${{ steps.branch-name.outputs.current_branch }}"
exit 1
- name: Test current branch output for tag based push event.
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !steps.branch-name.outputs.current_branch
- name: Test current_branch output for tag based push event.
if: github.event_name == 'push' && steps.branch-name.outputs.is_tag == 'true' && !steps.branch-name.outputs.current_branch
run: |
echo "Current branch unset: ${{ steps.branch-name.outputs.current_branch }}"
exit 1
- name: Test current tag for push events.
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !steps.branch-name.outputs.tag
- name: Test is_tag output for tag based push event.
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') == 'true'
run: |
echo "Current branch unset: ${{ steps.branch-name.outputs.current_branch }}"
exit 1
- name: Test tag output for tag based push event.
if: github.event_name == 'push' && steps.branch-name.outputs.is_tag == 'true' && !steps.branch-name.outputs.tag
run: |
echo "Current tag unset: ${{ steps.branch-name.outputs.tag }}"
exit 1
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ outputs:
is_default:
value: ${{ steps.default.outputs.is_default }}
description: 'Returns "true" if the current branch is the default else "false".'
is_tag:
value: ${{ steps.tag.outputs.is_tag }}
description: 'Returns "true" if the current branch is a tag else "false".'
current_branch:
value: ${{ steps.current_branch.outputs.current_branch }}
description: 'Returns the value of the current branch which is consistent regardless of event_type: i.e (push, pull_requests).'
Expand Down Expand Up @@ -72,6 +75,9 @@ runs:
REF=${{ github.ref }}
TAG=${REF/refs\/tags\/${{ inputs.strip_tag_prefix }}/}
echo "::set-output name=tag::$TAG"
echo "::set-output name=is_tag::true"
else
echo "::set-output name=is_tag::false"
fi
shell: bash

Expand Down

0 comments on commit 0183e3b

Please sign in to comment.