Skip to content

Commit bfec176

Browse files
Merge pull request #44 from devopselvis/copilot/create-multiple-workflow-files
Add workflows to test upload-artifact 500-file limit
2 parents e311eef + 5e98c7e commit bfec176

3 files changed

Lines changed: 113 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Workflow to test upload-artifact action with 501 files in a single upload
2+
# This tests the 500 file limit mentioned in https://github.com/actions/upload-artifact
3+
4+
name: Upload Artifact Test - Single Upload
5+
6+
# Controls when the action will run. Workflow runs when manually triggered using the UI or API.
7+
on:
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-single-upload:
12+
name: Test uploading 501 files in a single upload-artifact step
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
17+
steps:
18+
- name: Create 501 test files
19+
run: |
20+
mkdir -p test-files
21+
for i in {1..501}; do
22+
echo "This is test file number $i" > test-files/file-$i.txt
23+
done
24+
echo "Created $(ls test-files | wc -l) files"
25+
26+
- name: Upload all 501 files in a single step
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: test-501-files-single-upload
30+
path: test-files/
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Workflow to test upload-artifact action with 501 files split into 2 uploads
2+
# This tests the 500 file limit mentioned in https://github.com/actions/upload-artifact
3+
4+
name: Upload Artifact Test - Split Upload
5+
6+
# Controls when the action will run. Workflow runs when manually triggered using the UI or API.
7+
on:
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-split-upload:
12+
name: Test uploading 501 files in two separate upload-artifact steps
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
17+
steps:
18+
- name: Create 501 test files
19+
run: |
20+
mkdir -p test-files
21+
for i in {1..501}; do
22+
echo "This is test file number $i" > test-files/file-$i.txt
23+
done
24+
echo "Created $(ls test-files | wc -l) files"
25+
26+
- name: Create directories for split upload
27+
run: |
28+
mkdir -p test-files-part1 test-files-part2
29+
for i in {1..250}; do
30+
cp test-files/file-$i.txt test-files-part1/
31+
done
32+
for i in {251..501}; do
33+
cp test-files/file-$i.txt test-files-part2/
34+
done
35+
echo "Part 1 has $(ls test-files-part1 | wc -l) files"
36+
echo "Part 2 has $(ls test-files-part2 | wc -l) files"
37+
38+
- name: Upload files 1-250
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: test-501-files-split-upload-part1
42+
path: test-files-part1/
43+
44+
- name: Upload files 251-501
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: test-501-files-split-upload-part2
48+
path: test-files-part2/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Workflow to test upload-artifact action with 501 files zipped into a single file
2+
# This tests the 500 file limit mentioned in https://github.com/actions/upload-artifact
3+
4+
name: Upload Artifact Test - Zipped Upload
5+
6+
# Controls when the action will run. Workflow runs when manually triggered using the UI or API.
7+
on:
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-zipped-upload:
12+
name: Test uploading 501 files as a single zip file
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
17+
steps:
18+
- name: Create 501 test files
19+
run: |
20+
mkdir -p test-files
21+
for i in {1..501}; do
22+
echo "This is test file number $i" > test-files/file-$i.txt
23+
done
24+
echo "Created $(ls test-files | wc -l) files"
25+
26+
- name: Zip all files
27+
run: |
28+
zip -r test-files.zip test-files/
29+
echo "Zip file created: $(ls -lh test-files.zip)"
30+
31+
- name: Upload zip file
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: test-501-files-zipped
35+
path: test-files.zip

0 commit comments

Comments
 (0)