mirror of
https://github.com/actions/upload-pages-artifact.git
synced 2026-03-27 16:35:05 +00:00
# The Problem Hidden files and directories (e.g. `.well-known`) are unconditionally excluded from the tar archive. There is no way to include them. (#129) # The Solution Add an `include-hidden-files` input (default `false`) that skips the `--exclude=.[^/]*` pattern when set to `true`. `.git` and `.github` are always excluded regardless. Test coverage added for the new option. I think this is the right approach rather than #134. Keep the default behavior safe, and give a sane option to users who know what they're doing. It was safe enough for upload-artifact, it should be safe enough here. # Context `actions/upload-artifact` introduced hidden file exclusion and a corresponding `include-hidden-files` option in [v4.4.0](https://github.com/actions/upload-artifact/releases/tag/v4.4.0). This action adopted the same exclusion behavior in its tar step but never added the equivalent option. This PR closes that gap. The only sane workaround without this option is to drop this action, manually create the tar, and hand it to `upload-artifact` directly. See [expressjs/expressjs.com#2173](https://github.com/expressjs/expressjs.com/pull/2173) for an example.
103 lines
2.7 KiB
YAML
103 lines
2.7 KiB
YAML
name: Run Tests
|
|
|
|
#
|
|
# Create some files with script/new-artifact.sh and confirm they are properly packaged and uploaded
|
|
# as artifacts with the actions.
|
|
#
|
|
# This is tested on all OS platforms where we have hosted runners.
|
|
#
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Generate files
|
|
run: mkdir artifact && mkdir artifact2 && cd artifact && ../script/new-artifact.sh
|
|
shell: bash
|
|
|
|
- name: Upload Pages artifact
|
|
uses: ./
|
|
with:
|
|
name: pages-artifact-${{ matrix.os }}
|
|
path: artifact
|
|
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: pages-artifact-${{ matrix.os }}
|
|
path: artifact2
|
|
|
|
- name: Extract artifact
|
|
run: tar -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar
|
|
shell: bash
|
|
|
|
- name: Check for absence of hidden files
|
|
run: if [ $(find artifact2 -regex ".*/\..*" | wc -l) != 0 ]; then echo "Hidden files found"; exit 1; fi
|
|
shell: bash
|
|
|
|
- name: Compare files
|
|
run: |
|
|
rm artifact/.hidden
|
|
diff -qr artifact artifact2
|
|
shell: bash
|
|
|
|
- name: Check for absence of symlinks
|
|
run: if [ $(find artifact2 -type l | wc -l) != 0 ]; then echo "Symlinks found"; exit 1; fi
|
|
shell: bash
|
|
|
|
test-include-hidden:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Generate files
|
|
run: mkdir artifact && mkdir artifact2 && cd artifact && ../script/new-artifact.sh
|
|
shell: bash
|
|
|
|
- name: Upload Pages artifact
|
|
uses: ./
|
|
with:
|
|
name: pages-artifact-hidden-${{ matrix.os }}
|
|
path: artifact
|
|
include-hidden-files: true
|
|
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: pages-artifact-hidden-${{ matrix.os }}
|
|
path: artifact2
|
|
|
|
- name: Extract artifact
|
|
run: tar -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar
|
|
shell: bash
|
|
|
|
- name: Check for presence of hidden files
|
|
run: if [ $(find artifact2 -regex ".*/\..*" | wc -l) == 0 ]; then echo "Hidden files not found"; exit 1; fi
|
|
shell: bash
|
|
|
|
- name: Compare files
|
|
run: diff -qr artifact artifact2
|
|
shell: bash
|
|
|
|
- name: Check for absence of symlinks
|
|
run: if [ $(find artifact2 -type l | wc -l) != 0 ]; then echo "Symlinks found"; exit 1; fi
|
|
shell: bash
|