Skip to content

Commit

Permalink
feat: add additional parameter feature + add some logging (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
zahornyak authored Sep 11, 2024
1 parent c8c4903 commit 8cd9746
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
with:
connection-string: mongodb://root:root@database:27017
compress: true
additional-args: '--tlsInsecure'
- uses: actions/upload-artifact@v4
with:
name: dump-mongo${{ matrix.mongo-version }}
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ inputs:
required: false
default: 'false'
description: 'Compress the output file'
additional-args:
required: false
description: 'Additional arguments to pass to mongodump command'

runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.connection-string }}
- ${{ inputs.additional-args }}
- ${{ inputs.compress }}
post-entrypoint: '/action/cleanup.sh'

Expand Down
5 changes: 3 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/bash

cd /action
mongodump --uri=$1
mongodump --uri=$1 $2
echo "full command: mongodump --uri=$1 $2"
mkdir $GITHUB_WORKSPACE/dump
mv dump $GITHUB_WORKSPACE/

echo "Dump created and stored in $GITHUB_WORKSPACE/dump"

if [ "$2" = "true" ]; then
if [ "$3" = "true" ]; then
tar -zcvf $GITHUB_WORKSPACE/dump.tar.gz $GITHUB_WORKSPACE/dump
echo "Dump compressed and stored in $GITHUB_WORKSPACE/dump.tar.gz"
else
Expand Down

0 comments on commit 8cd9746

Please sign in to comment.