{"id":23421218,"url":"https://github.com/nhsdigital/transfer-artifact","last_synced_at":"2025-10-04T05:32:46.185Z","repository":{"id":248102666,"uuid":"754563111","full_name":"NHSDigital/transfer-artifact","owner":"NHSDigital","description":"Repo to allow the upload of pipeline artifacts from S3.  Originally cloned from https://github.com/diroussel/upload-artifact/tree/s3.","archived":false,"fork":false,"pushed_at":"2025-03-04T13:30:32.000Z","size":4261,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T14:29:08.105Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NHSDigital.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-08T10:20:40.000Z","updated_at":"2025-03-04T10:44:40.000Z","dependencies_parsed_at":"2024-07-12T12:05:33.147Z","dependency_job_id":"5ef977e1-a0d8-4780-8a7f-e072bc535665","html_url":"https://github.com/NHSDigital/transfer-artifact","commit_stats":null,"previous_names":["nhsdigital/transfer-artifact"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Ftransfer-artifact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Ftransfer-artifact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Ftransfer-artifact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NHSDigital%2Ftransfer-artifact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NHSDigital","download_url":"https://codeload.github.com/NHSDigital/transfer-artifact/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248016414,"owners_count":21033974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-23T02:14:27.823Z","updated_at":"2025-10-04T05:32:41.138Z","avatar_url":"https://github.com/NHSDigital.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transfer-Artifact v4\n\nThis uploads and downloads artifacts from your workflow to S3, allowing you to share data between jobs and store data once a workflow is complete.\n\nThis is based on [this fork](https://github.com/diroussel/upload-artifact/tree/s3) from the original Github action.\nSee also the original actions, [upload-artifact](https://github.com/actions/upload-artifact) and [download-artifact](https://github.com/actions/download-artifact).\n\n# Usage\n\nSee [action.yml](action.yml)\n\n### Upload an Individual File\n\n```yaml\nsteps:\n  - uses: actions/checkout@v3\n\n  - run: mkdir -p path/to/artifact\n\n  - run: echo hello \u003e path/to/artifact/world.txt\n\n  - uses: NHSDigital/transfer-artifact@s3\n    env:\n      bucket: abcd-123456789-eu-west-2-my-S3-bucket\n    with:\n      name: my-folder\n      direction: 'upload'\n      path: path/to/artifact/world.txt\n```\n\n### Upload an Entire Directory\n\n```yaml\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    direction: 'upload'\n    path: path/to/artifact/ # or path/to/artifact\n```\n\n### Upload using a Wildcard Pattern\n\n```yaml\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    direction: 'upload'\n    path: path/**/[abc]rtifac?/*\n```\n\n### Upload using Multiple Paths and Exclusions\n\n```yaml\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    direction: 'upload'\n    path: |\n      path/output/bin/\n      path/output/test-results\n      !path/**/*.tmp\n```\n\nFor supported wildcards along with behavior and documentation, see [@actions/glob](https://github.com/actions/toolkit/tree/main/packages/glob) which is used internally to search for files.\n\nIf a wildcard pattern is used, the path hierarchy will be preserved after the first wildcard pattern:\n\n```\npath/to/*/directory/foo?.txt =\u003e\n    ∟ path/to/some/directory/foo1.txt\n    ∟ path/to/some/directory/foo2.txt\n    ∟ path/to/other/directory/foo1.txt\n\nwould be flattened and uploaded as =\u003e\n    ∟ some/directory/foo1.txt\n    ∟ some/directory/foo2.txt\n    ∟ other/directory/foo1.txt\n```\n\nIf multiple paths are provided as input, the least common ancestor of all the search paths will be used as the root directory of the artifact. Exclude paths do not affect the directory structure.\n\nRelative and absolute file paths are both allowed. Relative paths are rooted against the current working directory. Paths that begin with a wildcard character should be quoted to avoid being interpreted as YAML aliases.\n\nThe [@actions/artifact](https://github.com/actions/toolkit/tree/main/packages/artifact) package is used internally to handle most of the logic around uploading an artifact. There is extra documentation around upload limitations and behavior in the toolkit repo that is worth checking out.\n\n### Customization if no files are found\n\nIf a path (or paths), result in no files being found for the artifact, the action will succeed but print out a warning. In certain scenarios it may be desirable to fail the action or suppress the warning. The `if-no-files-found` option allows you to customize the behavior of the action if no files are found:\n\n```yaml\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    direction: 'upload'\n    path: path/to/artifact/\n    if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`\n```\n\n### Conditional Artifact Upload\n\nTo upload artifacts only when the previous step of a job failed, use [`if: failure()`](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-status-check-functions):\n\n```yaml\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  if: failure()\n  with:\n    name: my-folder\n    direction: 'upload'\n    path: path/to/artifact/\n```\n\n### Uploading without an artifact name\n\nYou can upload an artifact without specifying a name\n\n```yaml\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    direction: 'upload'\n    path: path/to/artifact/world.txt\n```\n\nIf not provided, `artifact` will be used as the default name for the artifact, `upload-artifacts` will be the default name for the folder, and `upload` will be the direction of travel.\n\n### Uploading to the same artifact\n\nWith the following example, the available artifact (named `artifact` by default if no name is provided) would contain both `world.txt` (`hello`) and `extra-file.txt` (`howdy`):\n\n```yaml\n- run: echo hi \u003e world.txt\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    path: world.txt\n    direction: 'upload'\n\n- run: echo howdy \u003e extra-file.txt\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    path: extra-file.txt\n    direction: 'upload'\n\n- run: echo hello \u003e world.txt\n- uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    path: world.txt\n    direction: 'upload'\n```\n\nEach artifact behaves as a file share. Uploading to the same artifact multiple times in the same workflow can overwrite and append already uploaded files:\n\n```yaml\nstrategy:\n  matrix:\n    node-version: [8.x, 10.x, 12.x, 13.x]\nsteps:\n  - name: Create a file\n    run: echo ${{ github.run_number }} \u003e my_file.txt\n  - name: Accidentally upload to the same artifact via multiple jobs\n    uses: NHSDigital/transfer-artifact@s3\n    env:\n      bucket: abcd-123456789-eu-west-2-my-S3-bucket\n    with:\n      name: my-folder\n      direction: 'upload'\n      path: ${{ github.workspace }}\n```\n\n\u003e **_Warning:_** Be careful when uploading to the same artifact via multiple jobs as artifacts may become corrupted. When uploading a file with an identical name and path in multiple jobs, uploads may fail with 503 errors due to conflicting uploads happening at the same time. Ensure uploads to identical locations to not interfere with each other.\n\nIn the above example, four jobs will upload four different files to the same artifact but there will only be one file available when `my-artifact` is downloaded. Each job overwrites what was previously uploaded. To ensure that jobs don't overwrite existing artifacts, use a different name per job:\n\n```yaml\nuses: NHSDigital/transfer-artifact@s3\nenv:\n  bucket: abcd-123456789-eu-west-2-my-S3-bucket\nwith:\n  name: my-folder\n  direction: 'upload'\n  path: ${{ github.workspace }}\n```\n\n### Environment Variables and Tilde Expansion\n\nYou can use `~` in the path input as a substitute for `$HOME`. Basic tilde expansion is supported:\n\n```yaml\n  - run: |\n      mkdir -p ~/new/artifact\n      echo hello \u003e ~/new/artifact/world.txt\n  - uses: NHSDigital/transfer-artifact@s3\n    env:\n      bucket: abcd-123456789-eu-west-2-my-S3-bucket\n    with:\n      name: my-folder\n      name: Artifacts-V3\n      path: ~/new/**/*\n      direction: 'upload'\n```\n\nEnvironment variables along with context expressions can also be used for input. For documentation see [context and expression syntax](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions):\n\n```yaml\nsteps:\n  - run: |\n      mkdir -p ${{ github.workspace }}/artifact\n      echo hello \u003e ${{ github.workspace }}/artifact/world.txt\n  - uses: NHSDigital/transfer-artifact@s3\n    env:\n      bucket: abcd-123456789-eu-west-2-my-S3-bucket\n    with:\n      name: my-folder\n      path: ${{ github.workspace }}/artifact/**/*#\n      direction: 'upload'\n```\n\nFor environment variables created in other steps, make sure to use the `env` expression syntax\n\n```yaml\n    steps:\n    - run: |\n        mkdir testing\n        echo \"This is a file to upload\" \u003e testing/file.txt\n        echo \"artifactPath=testing/file.txt\" \u003e\u003e $GITHUB_ENV\n    - uses: NHSDigital/transfer-artifact@s3\n      env:\n        bucket: abcd-123456789-eu-west-2-my-S3-bucket\n      with:\n        name: my-folder\n        name: artifact\n        path: ${{ env.artifactPath }} # this will resolve to testing/file.txt at runtime\n        direction: 'upload'\n```\n\n### Retention Period\n\nArtifacts are retained for 90 days by default. You can specify a shorter retention period using the `retention-days` input:\n\n```yaml\n- name: Create a file\n  run: echo \"I won't live long\" \u003e my_file.txt\n\n- name: Upload Artifact\n  uses: NHSDigital/transfer-artifact@s3\n  env:\n    bucket: abcd-123456789-eu-west-2-my-S3-bucket\n  with:\n    name: my-folder\n    path: my_file.txt\n    retention-days: 5\n    direction: 'upload'\n```\n\nThe 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).\n\n## Where does the upload go?\n\nArtifacts are uploaded to the specified S3 bucket, into a folder called `folder-name`. The artifacts for each pipeline are put in a subfolder named `${{ github.run_number }}-folder-name`\n\n### Downloading all files\n\n```yaml\nsteps:\n  - uses: actions/checkout@v3\n\n  - uses: NHSDigital/transfer-artifact@s3\n    env:\n      bucket: abcd-123456789-eu-west-2-my-S3-bucket\n    with:\n      name: my-folder/path/to/artifact\n      direction: 'download'\n      path: local/download/folder\n```\n\nThis will download every object in the S3 bucket which matches the `my-folder/my-artifact/path/to/artifact` name prefix into a folder called `local/download/folder`.\n\n### Downloading one file\n\n```yaml\nsteps:\n  - uses: actions/checkout@v3\n\n  - uses: NHSDigital/transfer-artifact@s3\n    env:\n      bucket: abcd-123456789-eu-west-2-my-S3-bucket\n    with:\n      name: my-folder/path/to/artifact/word.txt\n      direction: 'download'\n      path: local/download/folder\n```\n\nThis will download only the file `my-artifact/path/to/artifact/word.txt` into a folder called `local/download/folder`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Ftransfer-artifact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhsdigital%2Ftransfer-artifact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhsdigital%2Ftransfer-artifact/lists"}