Skip to content

Commit

Permalink
PTFE-1257 uploading an empty directory
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Dec 21, 2023
1 parent 1a7f777 commit 9e8a017
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/test-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,18 @@ jobs:
- name: Compate files2
run: cmp --silent upload_action.yaml ./action.yaml

test-empty-folder:
runs-on: ubuntu-latest
environment: ${{ inputs.environment || 'production' }}
name: A job that try to push an empty folder
steps:
- uses: actions/checkout@v3
- run: mkdir -p artifacts
- name: Push all files
uses: ./
with:
url: ${{ vars.ARTIFACTS_URL }}
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: ./artifacts
method: upload
5 changes: 5 additions & 0 deletions src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ export async function upload(inputs: InputsArtifacts): Promise<void> {
requests.push(file)
}

// if no files are found, log a warning and exit
if (requests.length === 0) {
core.warning(`No files found for the provided path: ${inputs.source}`)
return
}
await async.eachLimit(requests, 16, async (file: string, next) => {
core.info(`Uploading file: ${file}`)
try {
Expand Down

0 comments on commit 9e8a017

Please sign in to comment.