mirror of
https://code.forgejo.org/actions/upload-artifact.git
synced 2025-05-18 15:14:47 +00:00
Exclude the .git
directory by default
This commit is contained in:
parent
834a144ee9
commit
3412bb46a4
18 changed files with 434 additions and 113 deletions
|
@ -5,6 +5,7 @@ Merge multiple [Actions Artifacts](https://docs.github.com/en/actions/using-work
|
|||
- [`@actions/upload-artifact/merge`](#actionsupload-artifactmerge)
|
||||
- [Usage](#usage)
|
||||
- [Inputs](#inputs)
|
||||
- [Uploading the `.git` directory](#uploading-the-git-directory)
|
||||
- [Outputs](#outputs)
|
||||
- [Examples](#examples)
|
||||
- [Combining all artifacts in a workflow run](#combining-all-artifacts-in-a-workflow-run)
|
||||
|
@ -59,6 +60,44 @@ For most cases, this may not be the most efficient solution. See [the migration
|
|||
compression-level:
|
||||
```
|
||||
|
||||
#### Uploading the `.git` directory
|
||||
|
||||
By default, files in a `.git` directory are ignored in the merged artifact.
|
||||
This is intended to prevent accidentally uploading Git credentials into an artifact that could then
|
||||
be extracted.
|
||||
If files in the `.git` directory are needed, ensure that `actions/checkout` is being used with
|
||||
`persist-credentials: false`.
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
upload:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
foo: [a, b, c]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false # Ensure credentials are not saved in `.git/config`
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: my-artifact-${{ matrix.foo }}
|
||||
path: .
|
||||
include-git-directory: true
|
||||
|
||||
merge:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/upload-artifact/merge@v4
|
||||
with:
|
||||
include-git-directory: true
|
||||
```
|
||||
|
||||
### Outputs
|
||||
|
||||
| Name | Description | Example |
|
||||
|
|
|
@ -36,6 +36,9 @@ inputs:
|
|||
If true, the artifacts that were merged will be deleted.
|
||||
If false, the artifacts will still exist.
|
||||
default: 'false'
|
||||
include-git-directory:
|
||||
description: 'Include files in the .git directory in the merged artifact.'
|
||||
default: 'false'
|
||||
|
||||
outputs:
|
||||
artifact-id:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue