check for artifact presence
This commit is contained in:
parent
0c1b7f687f
commit
969e9612f5
29
.github/workflows/make_card_db_pr.yml
vendored
29
.github/workflows/make_card_db_pr.yml
vendored
@ -14,27 +14,38 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/github-script@v3.1.0
|
- uses: actions/github-script@v3.1.0
|
||||||
|
id: get-metadata
|
||||||
with:
|
with:
|
||||||
|
result-encoding: string
|
||||||
script: |
|
script: |
|
||||||
var artifacts = await github.actions.listWorkflowRunArtifacts({
|
var artifacts = await github.actions.listWorkflowRunArtifacts({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
run_id: ${{github.event.workflow_run.id }},
|
run_id: ${{github.event.workflow_run.id }},
|
||||||
});
|
});
|
||||||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
|
||||||
return artifact.name == "card_db"
|
return artifact.name == "card_db"
|
||||||
})[0];
|
|
||||||
var download = await github.actions.downloadArtifact({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
artifact_id: matchArtifact.id,
|
|
||||||
archive_format: 'zip',
|
|
||||||
});
|
});
|
||||||
var fs = require('fs');
|
if (matchArtifacts.length > 0) {
|
||||||
fs.writeFileSync('${{github.workspace}}/card_db.zip', Buffer.from(download.data));
|
var matchArtifact = matchArtifacts[0];
|
||||||
|
var download = await github.actions.downloadArtifact({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
artifact_id: matchArtifact.id,
|
||||||
|
archive_format: 'zip',
|
||||||
|
});
|
||||||
|
var fs = require('fs');
|
||||||
|
fs.writeFileSync('${{github.workspace}}/card_db.zip', Buffer.from(download.data));
|
||||||
|
return 'found_artifact';
|
||||||
|
} else {
|
||||||
|
return 'no_artifact'
|
||||||
|
}
|
||||||
- run: unzip -d src/domdiv/card_db card_db.zip
|
- run: unzip -d src/domdiv/card_db card_db.zip
|
||||||
|
if: steps.get-metadata.output.result == 'found_artifact'
|
||||||
- run: rm -f card_db.zip
|
- run: rm -f card_db.zip
|
||||||
|
if: steps.get-metadata.output.result == 'found_artifact'
|
||||||
- name: Make PR
|
- name: Make PR
|
||||||
|
if: steps.get-metadata.output.result == 'found_artifact'
|
||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v3
|
||||||
with:
|
with:
|
||||||
body: |
|
body: |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user