Skip to content

Commit 1b63f0e

Browse files
authored
feat: adds support for actions/upload-artifact@v4 (#17) (fixed #14)
* feat: add support for upload-artifact@v4, deprecates support for previous versions * chore: update docs, fix CI workflow * docs: fix example * docs: add deprecation note * docs: add token note --------- Co-authored-by: Richard Herman <[email protected]>
1 parent dc8092f commit 1b63f0e

17 files changed

+31446
-3188
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ end_of_line = crlf
77
indent_style = space
88
indent_size = 4
99

10-
[{.yml}]
10+
[*.yml]
1111
indent_style = space
1212
indent_size = 2

.github/workflows/ci.yml

+43-43
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,56 @@ name: CI
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77

88
defaults:
99
run:
1010
shell: bash
1111

1212
jobs:
1313
test:
14-
runs-on: windows-latest
14+
runs-on: ubuntu-latest
1515

1616
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Create test file
21+
run: echo hello > world.txt
22+
23+
- uses: actions/upload-artifact@v4
24+
with:
25+
name: my-artifact
26+
path: world.txt
27+
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: my-artifact-2
31+
path: world.txt
32+
33+
- uses: actions/upload-artifact@v4
34+
with:
35+
name: my-artifact-3
36+
path: world.txt
37+
38+
- uses: actions/upload-artifact@v4
39+
with:
40+
name: you-artifact
41+
path: world.txt
42+
43+
- name: Delete (specific, glob disabled)
44+
uses: ./
45+
with:
46+
name: my-artifact
47+
useGlob: false
48+
49+
- name: Delete (pattern, glob enabled)
50+
uses: ./
51+
with:
52+
name: my-*
53+
54+
- name: Delete (specific, glob enabled)
55+
uses: ./
56+
with:
57+
name: you-artifact
1758

18-
- name: Checkout
19-
uses: actions/checkout@v2
20-
21-
- name: Create test file
22-
run: echo hello > world.txt
23-
24-
- uses: actions/upload-artifact@v2
25-
with:
26-
name: my-artifact
27-
path: world.txt
28-
29-
- uses: actions/upload-artifact@v2
30-
with:
31-
name: my-artifact-2
32-
path: world.txt
33-
34-
- uses: actions/upload-artifact@v2
35-
with:
36-
name: my-artifact-3
37-
path: world.txt
38-
39-
- uses: actions/upload-artifact@v2
40-
with:
41-
name: you-artifact
42-
path: world.txt
43-
44-
- name: Delete (specific, glob disabled)
45-
uses: ./
46-
with:
47-
name: my-artifact
48-
useGlob: false
49-
50-
- name: Delete (pattern, glob enabled)
51-
uses: ./
52-
with:
53-
name: my-*
54-
55-
- name: Delete (specific, glob enabled)
56-
uses: ./
57-
with:
58-
name: you-artifact

.github/workflows/example.yml

+43-44
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Example
33

44
on:
55
schedule:
6-
- cron: '0 */6 * * *'
6+
- cron: "0 */6 * * *"
77
# every 6 hours
88

99
defaults:
@@ -12,48 +12,47 @@ defaults:
1212

1313
jobs:
1414
test:
15-
runs-on: windows-latest
15+
runs-on: ubuntu-latest
1616

1717
steps:
18-
19-
- name: Checkout
20-
uses: actions/checkout@v2
21-
22-
- name: Create test file
23-
run: echo hello > world.txt
24-
25-
- uses: actions/upload-artifact@v2
26-
with:
27-
name: my-artifact
28-
path: world.txt
29-
30-
- uses: actions/upload-artifact@v2
31-
with:
32-
name: my-artifact-2
33-
path: world.txt
34-
35-
- uses: actions/upload-artifact@v2
36-
with:
37-
name: my-artifact-3
38-
path: world.txt
39-
40-
- uses: actions/upload-artifact@v2
41-
with:
42-
name: you-artifact
43-
path: world.txt
44-
45-
- name: Delete (specific, glob disabled)
46-
uses: geekyeggo/delete-artifact@v2
47-
with:
48-
name: my-artifact
49-
useGlob: false
50-
51-
- name: Delete (pattern, glob enabled)
52-
uses: geekyeggo/delete-artifact@v2
53-
with:
54-
name: my-*
55-
56-
- name: Delete (specific, glob enabled)
57-
uses: geekyeggo/delete-artifact@v2
58-
with:
59-
name: you-artifact
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Create test file
22+
run: echo hello > world.txt
23+
24+
- uses: actions/upload-artifact@v2
25+
with:
26+
name: my-artifact
27+
path: world.txt
28+
29+
- uses: actions/upload-artifact@v2
30+
with:
31+
name: my-artifact-2
32+
path: world.txt
33+
34+
- uses: actions/upload-artifact@v2
35+
with:
36+
name: my-artifact-3
37+
path: world.txt
38+
39+
- uses: actions/upload-artifact@v2
40+
with:
41+
name: you-artifact
42+
path: world.txt
43+
44+
- name: Delete (specific, glob disabled)
45+
uses: geekyeggo/delete-artifact@v2
46+
with:
47+
name: my-artifact
48+
useGlob: false
49+
50+
- name: Delete (pattern, glob enabled)
51+
uses: geekyeggo/delete-artifact@v2
52+
with:
53+
name: my-*
54+
55+
- name: Delete (specific, glob enabled)
56+
uses: geekyeggo/delete-artifact@v2
57+
with:
58+
name: you-artifact

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
3+
## {version}
4+
5+
🚨 Break
6+
✨ Add
7+
🐞 Fix
8+
♻️ Update
9+
10+
-->
11+
12+
# Change Log
13+
14+
## v4.0
15+
16+
- Add support for artifacts uploaded with `actions/upload-artifact@v4`.
17+
- Add requirement of `token` with read and write access to actions.
18+
- Update requests to use GitHub REST API.
19+
- Deprecate support for `actions/upload-artifact@v1`, `actions/upload-artifact@v2`, and `actions/upload-artifact@v3` (please use `geekyeggo/delete-artifact@v2`).
20+
21+
## v2.0
22+
23+
- Add support for glob pattern matching via `useGlob`.
24+
25+
## v1.0
26+
27+
- Initial release.
28+

README.md

+21-14
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,48 @@
55

66
A GitHub Action for deleting artifacts within the workflow run. This can be useful when artifacts are shared across jobs, but are no longer needed when the workflow is complete.
77

8+
## ✅ Compatibility
9+
10+
| `actions/upload-artifact` | `geekyeggo/delete-artifact` |
11+
| ------------------------- | --------------------------- |
12+
| `@v1`, `@v2`, `@v3` | `@v1`, `@v2` |
13+
| `@v4` | `@v4` |
14+
815
## ⚡ Usage
916

1017
See [action.yml](action.yml)
1118

12-
> **Warning**
13-
> From version 2 onwards, glob (wildcard) support is on by default, and is fulfilled by [minimatch](https://www.npmjs.com/package/minimatch); this can be disabled by setting `useGlob` to `false`.
19+
> [!IMPORTANT]
20+
> Support for `actions/upload-artifact@v4` utilizes GitHub's REST API, and requires a token with read and write access to actions.
1421
1522
### Delete an individual artifact
1623

1724
```yml
1825
steps:
19-
- uses: actions/checkout@v2
26+
- name: Checkout
27+
uses: actions/checkout@v4
2028

21-
- run: echo hello > world.txt
29+
- name: Create test file
30+
run: echo hello > test.txt
2231

23-
- uses: actions/upload-artifact@v2
32+
- uses: actions/upload-artifact@v4
2433
with:
2534
name: my-artifact
26-
path: world.txt
35+
path: test.txt
2736

28-
# delete-artifact
29-
- uses: geekyeggo/delete-artifact@v2
37+
- uses: geekyeggo/delete-artifact@v4
3038
with:
39+
token: ${{ secrets.TOKEN }}
3140
name: my-artifact
3241
```
3342
3443
### Specify multiple names
3544
3645
```yml
3746
steps:
38-
- uses: geekyeggo/delete-artifact@v2
47+
- uses: geekyeggo/delete-artifact@v4
3948
with:
49+
token: ${{ secrets.TOKEN }}
4050
name: |
4151
artifact-*
4252
binary-file
@@ -49,13 +59,10 @@ By default, the action will fail when it was not possible to delete an artifact
4959
5060
```yml
5161
steps:
52-
- uses: geekyeggo/delete-artifact@v2
62+
- uses: geekyeggo/delete-artifact@v4
5363
with:
64+
token: ${{ secrets.TOKEN }}
5465
name: okay-to-keep
5566
failOnError: false
5667
```
5768
58-
## ⚠ Disclaimer
59-
60-
This action utilizes a preview version of GitHub's runtime API; the API is subject to change at any time which may result in failures of this action.
61-

action.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ inputs:
44
name:
55
description: The name of the artifact to delete; multiple names can be supplied on new lines.
66
required: true
7+
token:
8+
description: GitHub token with read and write access to actions for the repository.
9+
required: true
710
useGlob:
811
description: Indicates whether the name, or names, should be treated as glob patterns.
912
required: false
10-
default: 'true'
13+
default: "true"
1114
failOnError:
1215
description: Indicates whether the action should fail upon encountering an error.
1316
required: false
14-
default: 'true'
17+
default: "true"
1518
runs:
16-
using: node16
19+
using: node20
1720
main: ./dist/index.js
1821
branding:
1922
icon: trash-2
2023
color: red
24+

0 commit comments

Comments
 (0)