Skip to content

Commit

Permalink
Add support for dagger run and workdir
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Adams <jeremy@dagger.io>
  • Loading branch information
jpadams committed Nov 14, 2023
1 parent 56c183f commit 9e4beb8
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,51 @@ inputs:
dagger-flags:
description: 'Dagger CLI Flags'
required: false
default: '-s'
default: '--progress plain'
verb:
description: 'CLI verb (call, download, up, functions, shell, query)'
required: false
default: 'call'
workdir:
description: 'The working directory in which to run the Dagger CLI'
required: false
default: '.'
cloud-token:
description: 'Dagger Cloud Token'
required: false
default: ''
module:
description: 'Dagger module to call. Local or Git'
required: false
default: '.'
default: ''
args:
description: 'Arguments to pass to CLI'
required: false
default: ''
runs:
using: "composite"
steps:
- run: cd /usr/local && { curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=${{ inputs.version }} sh; cd -; }
- run: |
cd /usr/local && { \
curl -sL https://dl.dagger.io/dagger/install.sh 2>/dev/null | \
DAGGER_VERSION=${{ inputs.version }} sh 2>/dev/null; }
shell: bash
- run: if ! [ -d ./.git ]; then git clone -b ${GITHUB_REF_NAME} --no-checkout https://github.com/${GITHUB_REPOSITORY} .; fi
shell: bash
- run: DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} /usr/local/bin/dagger ${{ inputs.dagger-flags }} ${{ inputs.verb }} -m ${{ inputs.module }} ${{ inputs.args }}

- run: |
cd ${{ inputs.workdir }} && { \
DAGGER_CLOUD_TOKEN=${{ inputs.cloud-token }} \
/usr/local/bin/dagger \
${{ inputs.dagger-flags }} \
${{ inputs.verb }} \
${INPUT_MODULE:+-m $INPUT_MODULE} \
${{ inputs.args }}; }
shell: bash
env:
INPUT_MODULE: ${{ inputs.module }}
- run: docker stop -t 300 $(docker ps --filter name="dagger-engine-*" -q)
shell: bash
if: ${{ always() }}

0 comments on commit 9e4beb8

Please sign in to comment.