Skip to content

Commit

Permalink
Fail if xl
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Feb 27, 2020
1 parent 5f3b5ec commit ca05d28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
description: 'Max size for a PR to be considered l'
required: false
default: '1000'
fail_if_xl:
description: 'Fail if the PR is of xl size'
required: false
default: 'false'
runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -29,3 +33,4 @@ runs:
- ${{ inputs.s_max_size }}
- ${{ inputs.m_max_size }}
- ${{ inputs.l_max_size }}
- ${{ inputs.fail_if_xl }}
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ s_max_size="$3"
m_max_size="$4"
l_max_size="$5"

fail_if_xl="$6"

URI="https://api.github.com"
API_HEADER="Accept: application/vnd.github.v3+json"
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
Expand Down Expand Up @@ -46,6 +48,11 @@ autolabel() {
-H "Content-Type: application/json" \
-d "{\"labels\":[\"${label_to_add}\"]}" \
"${URI}/repos/${GITHUB_REPOSITORY}/issues/${number}/labels"

if [ "$label_to_add" == "size/xl" ] && [ "$fail_if_xl" == "true" ]; then
echo "Pr is xl, please, short this!!"
exit 1
fi
}

label_for() {
Expand All @@ -65,3 +72,5 @@ label_for() {
}

autolabel

exit $?

0 comments on commit ca05d28

Please sign in to comment.