Skip to content

Test Download Artifacts Action #555

Test Download Artifacts Action

Test Download Artifacts Action #555

---
name: Test Download Artifacts Action
on:
workflow_dispatch:
inputs: {}
workflow_run:
workflows:
- Upload Test Artifacts
types:
- completed
jobs:
download-latest:
name: Download Latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
artifacts: artifact
path: artifact
- name: Test
run: |
cat artifact/sha
echo $GITHUB_SHA
download-main:
name: Download main
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
artifacts: artifact
path: artifact
branch: main
- name: Test
run: |
cat artifact/sha
echo $GITHUB_SHA
download-branch:
name: Download current branch
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Extract branch name
id: extract_branch
run: |
branch=${GITHUB_REF#refs/heads/}
echo "branch=$branch" >> $GITHUB_OUTPUT
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
artifacts: artifact
path: artifact
branch: ${{ steps.extract_branch.outputs.branch }}
- name: Test
run: |
cat artifact/sha
echo $GITHUB_SHA
download-pr:
name: Download Pull Request
runs-on: ubuntu-22.04
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
artifacts: artifact
path: artifact
pr: ${{github.event.pull_request.number}}
- name: Test
run: |
cat artifact/sha
echo $GITHUB_SHA
download-all:
name: Download All
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
- name: Test
run: |
ls -atlh
cat sha
cat sha1
cat sha2
download-multiple:
name: Download Multiple
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
artifacts: 'artifact1,
artifact2'
- name: Test
run: |
ls -atlh
cat sha1
cat sha2
download-wildcard:
name: Download Wildcard
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
artifacts: '*.txt'
- name: Test
run: |
ls -atlh
cat sha1
cat sha2
download-conclusion:
name: Download Conclusion
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
artifacts: artifact
path: artifact
workflow_conclusion: ''
- name: Test
run: |
cat artifact/sha
echo $GITHUB_SHA
download-outputs:
name: Download outputs should not be empty
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Download
id: download
uses: ./download-artifacts
with:
workflow: upload-test-artifacts.yml
- name: Test artifact-build-commit
env:
_ARTIFACT_BUILD_COMMIT: ${{ steps.download.outputs.artifact-build-commit }}
run: |
ls -atlh
echo $_ARTIFACT_BUILD_COMMIT
if [[-z "$_ARTIFACT_BUILD_COMMIT"]]; then
echo "artifact-build-commit is empty"
exit 1
fi
- name: Test artifact-build-branch
env:
_ARTIFACT_BUILD_BRANCH: ${{ steps.download.outputs.artifact-build-branch }}
run: |
ls -atlh
echo $_ARTIFACT_BUILD_BRANCH
if [[-z "$_ARTIFACT_BUILD_BRANCH"]]; then
echo "artifact-build-branch is empty"
exit 1
fi