redhat-plumbers-in-action / download-artifact

📥 Download repository artifact based on it's name and process it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Download Artifact on workflow_run event

GitHub Marketplace Lint Code Base Unit Tests CodeQL Check dist/

Demo codecov

Hugely inspired by work of @marocchino in marocchino/on_artifact.

Usage

name: Upload Artifact
on:
  pull_request:

permissions:
  contents: read

jobs:
  upload-artifact:
    runs-on: ubuntu-latest

    permissions:
      # only required for workflows in private repositories
      actions: read

    steps:
      - name: Repository checkout
        uses: actions/checkout@v3

      - name: Upload artifact
        uses: actions/upload-artifact@v3
        with:
          name: README as Artifact
          path: README.md
name: Download Artifact
on:
  workflow_run:
    workflows: [ Upload Artifact ]
    types:
      - completed

permissions:
  contents: read

jobs:
  download-artifact:
    if: >
      github.event.workflow_run.event == 'pull_request' &&
      github.event.workflow_run.conclusion == 'success'
    runs-on: ubuntu-latest

    permissions:
      # required for all workflows when deleting artifact
      actions: write

    steps:
      - id: Artifact
        name: Download Artifact
        uses: redhat-plumbers-in-action/download-artifact@main
        with:
          name: README as Artifact

      - name: Log Artifact data
        run: |
          echo "::warning::${{ steps.Artifact.outputs.README-md }}"

Configuration options

Action currently accepts the following options:

# ...

- uses: redhat-plumbers-in-action/download-artifact@v1
  with:
    name: <name of artifact>
    path: <relative path>
    remove-archive: <boolean>
    remove-extracted-files: <boolean>
    delete-artifact: <boolean>
    run-id: <id>
    token: <GITHUB_TOKEN or PAT>

# ...

name

Name of artifact.

  • default value: undefined
  • requirements: required

path

Downloaded artifact archive will be extracted to this destination. Default value is artifact name. Make sure that specified path exist.

  • default value: name of artifact
  • requirements: optional

remove-archive

When set to true, downloaded artifact archive will be removed from VM once it's extracted.

  • default value: true
  • requirements: optional

remove-extracted-files

When set to true, files extracted form artifact will be removed from VM. They will be still accessible by GitHub Action outputs.

  • default value: false
  • requirements: optional

delete-artifact

When set to true, GitHub Action will delete artifact from GitHub after it has been processed.

  • default value: false
  • requirements: optional

run-id

Identification of workflow with artifact that we want to download.

  • default value: ${{ github.event.workflow_run.id }}
  • requirements: optional

token

GitHub token used access GitHub API.

  • default value: ${{ github.token }}
  • requirements: optional

About

📥 Download repository artifact based on it's name and process it

License:MIT License


Languages

Language:TypeScript 100.0%