5 Commits

Author SHA1 Message Date
Peter Evans
f2b0643b95 Update workflow 2020-08-22 09:52:30 +09:00
Peter Evans
a6985f583c Update action version 2020-08-22 09:51:01 +09:00
Peter Evans
b6bd2fd8c2 Check the readme file exists 2020-08-22 09:46:01 +09:00
Peter Evans
b5167ca4ba Update action version 2020-08-02 17:32:37 +09:00
Peter Evans
10e602777f Output clearer action result message 2020-08-02 17:26:51 +09:00
4 changed files with 11 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
name: Update Docker Hub Description name: Update Docker Hub Description
on: on:
workflow_dispatch:
push: push:
branches: branches:
- master - master

View File

@@ -94,7 +94,7 @@ docker run -v $PWD:/workspace \
-e DOCKERHUB_PASSWORD='xxxxx' \ -e DOCKERHUB_PASSWORD='xxxxx' \
-e DOCKERHUB_REPOSITORY='user1/my-docker-image' \ -e DOCKERHUB_REPOSITORY='user1/my-docker-image' \
-e README_FILEPATH='/workspace/README.md' \ -e README_FILEPATH='/workspace/README.md' \
peterevans/dockerhub-description:2.2 peterevans/dockerhub-description:2.3
``` ```
## License ## License

View File

@@ -16,7 +16,7 @@ description: 'An action to update a Docker Hub repository description from READM
# default: ./README.md # default: ./README.md
runs: runs:
using: 'docker' using: 'docker'
image: 'docker://peterevans/dockerhub-description:2.2.0' image: 'docker://peterevans/dockerhub-description:2.3.1'
branding: branding:
icon: 'upload' icon: 'upload'
color: 'blue' color: 'blue'

View File

@@ -25,6 +25,12 @@ fi
# Set the default path to README.md # Set the default path to README.md
README_FILEPATH=${README_FILEPATH:="./README.md"} README_FILEPATH=${README_FILEPATH:="./README.md"}
# Check the file exists
if [ ! -f ${README_FILEPATH} ]; then
echo "Readme file not found"
exit 1
fi
# Check the file size # Check the file size
if [ $(wc -c <${README_FILEPATH}) -gt 25000 ]; then if [ $(wc -c <${README_FILEPATH}) -gt 25000 ]; then
echo "File size exceeds the maximum allowed 25000 bytes" echo "File size exceeds the maximum allowed 25000 bytes"
@@ -43,7 +49,9 @@ RESPONSE_CODE=$(curl -s --write-out %{response_code} --output /dev/null -H "Auth
echo "Received response code: $RESPONSE_CODE" echo "Received response code: $RESPONSE_CODE"
if [ $RESPONSE_CODE -eq 200 ]; then if [ $RESPONSE_CODE -eq 200 ]; then
echo "Request successful"
exit 0 exit 0
else else
echo "Request failed"
exit 1 exit 1
fi fi