Skip to content

Commit

Permalink
Add validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alikhil committed Dec 6, 2024
1 parent dd1969f commit 92cc535
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Validate image
run: |
IMAGE="${{ github.event.inputs.image_name }}"
if [[ "$IMAGE" == *.* ]]; then
echo "Image name contains a domain, exiting. Only short dockerhub image names are allowed"
exit 1
fi
- name: Copy image to GHCR
env:
IMAGE: ${{ github.event.inputs.image_name }}
run: |
NEW_IMAGE_NAME="${IMAGE//\//-}"
skopeo copy \
--dest-creds="${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
"docker://${{ github.event.inputs.image_name }}" \
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# image-mirrors
dynamic image mirror
# image-mirror

Dynamic dockerhub images mirror.

0 comments on commit 92cc535

Please sign in to comment.