This is intended as a collection of GH actions I'm tired of recreating in some fashion over and over, and centralizing it.
This should be used in test workflows, allowing them to be reusable both for standard PR/merge, and so you can run that workflow against an actual release source itself. Testing against the git repo does not guarantee the release source you created (python sdist for example) will pass your acceptance tests, thus for a release it is desirable to run them against that actual release artifact.
This is a rough example of how to use it:
# your common test workflow.
name: tests
on:
push: # whatever you normally react to
workflow_call:
inputs:
release-artifact-id:
type: string
default: ''
description: "release artifact to run tests against. If not supplied, default to actions/checkout"
release-artifact-runner-id:
type: string
default: ''
description: "The github.runner that the artifact was generated by. This is mandatory if release-artifact-id is set"
jobs:
tests:
# .... use boilerplate.
steps:
- name: Checkout source
uses: ferringb/gh-actions/get-source@v1
with:
artifact-id: ${{ inputs.release-artifact-id }}
artifact-runner-id: ${{ inputs.release-artifact-runner-id }}
This workflow will do a standard clone if artifact-id is empty. If not, it'll fetch from github that source and unpack it (stripping off the leading directory name).
For example, if the artifact is of a test release- package-1.0.tar.gz which internally (per release norms) is package-1.0/* for where the source it, it will unpack it moving the content of package-1.0/* to ..
If you require it to be unpacked to a different path, this is supported in the same way as action/checkout@v5 supports it.