A GitHub action to update a Docker Hub repository description from README.md https://github.com/peter-evans/dockerhub-description.git
Find a file
2020-12-28 01:06:26 +00:00
.github/workflows ci: fix input names 2020-09-25 15:48:51 +09:00
dist build: update distribution 2020-12-28 01:06:26 +00:00
src fix: throw errors on request failure 2020-10-27 10:41:21 +09:00
.eslintignore refactor: convert to typescript 2020-09-23 15:58:54 +09:00
.eslintrc.json refactor: convert to typescript 2020-09-23 15:58:54 +09:00
.gitignore refactor: convert to typescript 2020-09-23 15:58:54 +09:00
.prettierignore refactor: convert to typescript 2020-09-23 15:58:54 +09:00
.prettierrc.json refactor: convert to typescript 2020-09-23 15:58:54 +09:00
action.yml feat: add input for short description 2020-09-25 15:22:36 +09:00
Dockerfile refactor: update image to execute action with node 2020-09-23 17:23:10 +09:00
entrypoint.sh refactor: update image to execute action with node 2020-09-23 17:23:10 +09:00
jest.config.js refactor: convert to typescript 2020-09-23 15:58:54 +09:00
LICENSE Initial commit 2019-06-25 19:19:47 +09:00
package-lock.json chore: update dependencies 2020-12-24 02:02:44 +00:00
package.json chore: update dependencies 2020-12-24 02:02:44 +00:00
README.md feat: add input for short description 2020-09-25 15:22:36 +09:00
tsconfig.json refactor: convert to typescript 2020-09-23 15:58:54 +09:00

Docker Hub Description

GitHub Marketplace

A GitHub action to update a Docker Hub repository description from README.md.

This is useful if you docker push your images to Docker Hub. It provides an easy, automated way to keep your Docker Hub repository description in sync with your GitHub repository README.md file.

Usage

    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v2
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
        repository: peterevans/dockerhub-description

Action inputs

Note: Docker Hub Personal Access Tokens cannot be used as they are not supported by the API. See here and here for further details. Unfortunately, this means that enabling 2FA on Docker Hub will prevent the action from working.

Name Description Default
username (required) Docker Hub username. If updating a Docker Hub repository belonging to an organization, this user must have Admin permissions for the repository.
password (required) Docker Hub password.
repository Docker Hub repository in the format <namespace>/<name>. github.repository
short-description Docker Hub repository short description. Input exceeding 100 characters will be truncated.
readme-filepath Path to the repository readme. ./README.md

Specifying the file path

The action assumes that there is a file called README.md located at the root of the repository. If this is not the case the path can be specified with the readme-filepath input.

    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v2
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
        repository: peterevans/dockerhub-description
        readme-filepath: ./path/to/README.md

Examples

The following workflow updates the Docker Hub repository description whenever there are changes to README.md and the workflow file itself on the master branch. This workflow assumes its location to be .github/workflows/dockerhub-description.yml.

name: Update Docker Hub Description
on:
  push:
    branches:
      - master
    paths:
      - README.md
      - .github/workflows/dockerhub-description.yml
jobs:
  dockerHubDescription:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v2
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
        repository: peterevans/dockerhub-description

Updates the Docker Hub repository description whenever a new release is created.

name: Update Docker Hub Description
on: release
jobs:
  dockerHubDescription:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v2
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
        repository: peterevans/dockerhub-description

Using the Docker image independently of GitHub Actions

The image can be executed in other environments independently of GitHub Actions. Simply volume mount the location of the README.md file to the container and set environment variables as follows.

docker run -v $PWD:/workspace \
  -e DOCKERHUB_USERNAME='user1' \
  -e DOCKERHUB_PASSWORD='xxxxx' \
  -e DOCKERHUB_REPOSITORY='user1/my-docker-image' \
  -e README_FILEPATH='/workspace/README.md' \
  peterevans/dockerhub-description:2

License

MIT