Skip to content

Commit 672174a

Browse files
authored
Merge pull request #606 from actions/v3/node16
Carry forward `v3/node16` updates to `v3/node20`
2 parents 97a0fba + 9ee08a3 commit 672174a

10 files changed

+206
-69
lines changed

Diff for: README.md

+23
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,29 @@ Artifacts are retained for 90 days by default. You can specify a shorter retenti
237237

238238
The retention period must be between 1 and 90 inclusive. For more information see [artifact and log retention policies](https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy).
239239

240+
241+
### Hidden Files
242+
243+
By default, hidden files are ignored by this action to avoid unintentionally uploading sensitive information.
244+
245+
In versions of this action before v3.2.0, these hidden files were included by default.
246+
247+
If you need to upload hidden files, you can use the `include-hidden-files` input.
248+
249+
```yaml
250+
jobs:
251+
upload:
252+
runs-on: ubuntu-latest
253+
steps:
254+
- name: Create a Hidden File
255+
run: echo "hello from a hidden file" > .hidden-file.txt
256+
- name: Upload Artifact
257+
uses: actions/upload-artifact@v3
258+
with:
259+
path: .hidden-file.txt
260+
include-hidden-files: true
261+
```
262+
240263
## Where does the upload go?
241264

242265
At the bottom of the workflow summary page, there is a dedicated section for artifacts. Here's a screenshot of something you might see:

Diff for: __tests__/search.test.ts

+51
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ const lonelyFilePath = path.join(
6161
'lonely-file.txt'
6262
)
6363

64+
const hiddenFile = path.join(root, '.hidden-file.txt')
65+
const fileInHiddenFolderPath = path.join(
66+
root,
67+
'.hidden-folder',
68+
'folder-in-hidden-folder',
69+
'file.txt'
70+
)
71+
const fileInHiddenFolderInFolderA = path.join(
72+
root,
73+
'folder-a',
74+
'.hidden-folder-in-folder-a',
75+
'file.txt'
76+
)
77+
6478
describe('Search', () => {
6579
beforeAll(async () => {
6680
// mock all output so that there is less noise when running tests
@@ -92,6 +106,13 @@ describe('Search', () => {
92106
await fs.mkdir(path.join(root, 'folder-h', 'folder-j', 'folder-k'), {
93107
recursive: true
94108
})
109+
await fs.mkdir(
110+
path.join(root, '.hidden-folder', 'folder-in-hidden-folder'),
111+
{recursive: true}
112+
)
113+
await fs.mkdir(path.join(root, 'folder-a', '.hidden-folder-in-folder-a'), {
114+
recursive: true
115+
})
95116

96117
await fs.writeFile(searchItem1Path, 'search item1 file')
97118
await fs.writeFile(searchItem2Path, 'search item2 file')
@@ -110,10 +131,19 @@ describe('Search', () => {
110131
await fs.writeFile(amazingFileInFolderHPath, 'amazing file')
111132

112133
await fs.writeFile(lonelyFilePath, 'all by itself')
134+
135+
await fs.writeFile(hiddenFile, 'hidden file')
136+
await fs.writeFile(fileInHiddenFolderPath, 'file in hidden directory')
137+
await fs.writeFile(fileInHiddenFolderInFolderA, 'file in hidden directory')
113138
/*
114139
Directory structure of files that get created:
115140
root/
141+
.hidden-folder/
142+
folder-in-hidden-folder/
143+
file.txt
116144
folder-a/
145+
.hidden-folder-in-folder-a/
146+
file.txt
117147
folder-b/
118148
folder-c/
119149
search-item1.txt
@@ -136,6 +166,7 @@ describe('Search', () => {
136166
folder-j/
137167
folder-k/
138168
lonely-file.txt
169+
.hidden-file.txt
139170
search-item5.txt
140171
*/
141172
})
@@ -352,4 +383,24 @@ describe('Search', () => {
352383
)
353384
expect(searchResult.filesToUpload.includes(lonelyFilePath)).toEqual(true)
354385
})
386+
387+
it('Hidden files ignored by default', async () => {
388+
const searchPath = path.join(root, '**/*')
389+
const searchResult = await findFilesToUpload(searchPath)
390+
391+
expect(searchResult.filesToUpload).not.toContain(hiddenFile)
392+
expect(searchResult.filesToUpload).not.toContain(fileInHiddenFolderPath)
393+
expect(searchResult.filesToUpload).not.toContain(
394+
fileInHiddenFolderInFolderA
395+
)
396+
})
397+
398+
it('Hidden files included', async () => {
399+
const searchPath = path.join(root, '**/*')
400+
const searchResult = await findFilesToUpload(searchPath, true)
401+
402+
expect(searchResult.filesToUpload).toContain(hiddenFile)
403+
expect(searchResult.filesToUpload).toContain(fileInHiddenFolderPath)
404+
expect(searchResult.filesToUpload).toContain(fileInHiddenFolderInFolderA)
405+
})
355406
})

Diff for: action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ inputs:
2323
2424
Minimum 1 day.
2525
Maximum 90 days unless changed from the repository settings page.
26+
include-hidden-files:
27+
description: >
28+
If true, hidden files will be included in the uploaded artifact.
29+
If false, hidden files will be excluded from the uploaded artifact.
30+
default: 'false'
2631
runs:
2732
using: 'node20'
2833
main: 'dist/index.js'

0 commit comments

Comments
 (0)