Skip to content

Commit

Permalink
Change how dockerhub job sets the short-description in update GA work…
Browse files Browse the repository at this point in the history
…flow

Add support for syncing the short-description with the repository
description through the GitHub API. Also, change existing steps to
validate the number of characters and report using Slack messages.
  • Loading branch information
victorpopkov committed Mar 17, 2024
1 parent ee40291 commit 3f86e15
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,42 @@ jobs:
if: ${{ github.event_name != 'pull_request' }}
id: slack
with:
fields: |
{STATUS}
{REF}
Short description length: Checking...
Description length: Checking...
status: in-progress
- name: Output additional GitHub context
id: github
run: |
description=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}" | \
jq -r '.description')
echo "description=$description" >> $GITHUB_OUTPUT
- name: Output lengths
id: lengths
run: |
description=$(cat ./DOCKERHUB.md | wc -c)
short_description=$(echo '${{ steps.github.outputs.description }}' | wc -c)
echo "description=$description" >> $GITHUB_OUTPUT
echo "short-description=$short_description" >> $GITHUB_OUTPUT
- name: Check results
run: |
description_length='${{ steps.lengths.outputs.description }}'
short_description='${{ steps.github.outputs.description }}'
short_description_length='${{ steps.lengths.outputs.short-description }}'
echo "Short description: $short_description"
echo "Short description length: $short_description_length"
echo "Description length: $description_length"
exit_code=1
if [ "$description_length" -gt 0 ] && [ "$description_length" -lt 25000 ] && [ "$short_description_length" -gt 0 ]; then
exit_code=0
fi
exit "$exit_code"
- name: Update Docker Hub repository overview
uses: peter-evans/dockerhub-description@v3
if: ${{ !env.ACT }}
Expand All @@ -38,5 +73,10 @@ jobs:
uses: codedsolar/slack-action@v1
if: ${{ github.event_name != 'pull_request' && always() }}
with:
fields: |
{STATUS}
{REF}
Short description length: ${{ steps.lengths.outputs.short-description || 'Skipped' }}
Description length: ${{ steps.lengths.outputs.description || 'Skipped' }}
status: ${{ job.status }}
timestamp: ${{ steps.slack.outputs.slack-timestamp }}

0 comments on commit 3f86e15

Please sign in to comment.