Skip to content

Commit

Permalink
Merge branch 'main' into pr
Browse files Browse the repository at this point in the history
  • Loading branch information
pngwn authored Aug 1, 2024
2 parents 11478e0 + 433b530 commit 8c71f19
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions .github/workflows/run_later.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,20 @@ on:
workflows: ["Create and Upload Artifact"]
types:
- completed

permissions:
actions: read

jobs:
download-artifact:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download artifact
uses: actions/github-script@v6
uses: actions/download-artifact@v3
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }}
})
const matchArtifact = artifacts.data.artifacts.find(artifact => artifact.name === "sample-artifact")
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip'
})
const fs = require('fs')
fs.writeFileSync('${{github.workspace}}/sample-artifact.zip', Buffer.from(download.data))
- name: Unzip artifact
run: unzip sample-artifact.zip
name: sample-artifact
path: artifact-download

- name: Cat file content
run: cat sample_file.txt
run: cat artifact-download/sample_file.txt

0 comments on commit 8c71f19

Please sign in to comment.