Skip to content

Commit 4ec1823

Browse files
committed
test
1 parent e70a4c9 commit 4ec1823

File tree

1 file changed

+22
-31
lines changed

1 file changed

+22
-31
lines changed

.github/workflows/update-from-latest.yml

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,32 @@ on:
77
- cron: '0 6 * * *' # Daily at 6 AM
88

99
jobs:
10-
download-latest:
10+
download-artifact:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Get latest successful run
14-
id: get-run
15-
uses: actions/github-script@v7
16-
with:
17-
github-token: ${{ secrets.GITHUB_TOKEN }}
18-
script: |
19-
const { data: runs } = await github.rest.actions.listWorkflowRuns({
20-
owner: 'OPM',
21-
repo: 'ResInsight',
22-
workflow_id: 'ResInsightWithCache.yml', # or workflow filename
23-
status: 'success',
24-
per_page: 1
25-
});
26-
27-
if (runs.total_count === 0) {
28-
core.setFailed('No successful runs found');
29-
return;
30-
}
31-
32-
core.setOutput('run-id', runs[0].id);
33-
core.setOutput('run-url', runs[0].html_url);
13+
- name: Set up authentication
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.PAT }}
16+
run: |
17+
echo "Authenticated with PAT"
18+
19+
- name: Get latest successful workflow run
20+
id: get_run
21+
run: |
22+
curl -H "Authorization: token ${{ secrets.PAT }}" \
23+
https://api.github.com/repos/OPM/ResInsight/actions/workflows/ResInsightWithCache/runs \
24+
| jq '.workflow_runs[] | select(.conclusion=="success") | .id' \
25+
| head -n 1 > run_id.txt
26+
echo "run_id=$(cat run_id.txt)" >> $GITHUB_ENV
27+
28+
- name: Download artifact
29+
run: |
30+
curl -H "Authorization: token ${{ secrets.PAT }}" \
31+
-L https://api.github.com/repos/OPM/ResInsight/actions/runs/${{ env.run_id }}/artifacts \
32+
-o artifact.zip
3433
35-
- name: Download artifacts
36-
uses: actions/download-artifact@v4
37-
with:
38-
name: build-artifacts # Name of the artifact
39-
repository: target-owner/target-repo
40-
run-id: ${{ steps.get-run.outputs.run-id }}
41-
github-token: ${{ secrets.GITHUB_TOKEN }}
42-
path: ./downloaded-artifacts
4334
4435
- name: List downloaded files
4536
run: |
4637
echo "Downloaded files:"
47-
ls -la ./downloaded-artifacts/
38+
ls -la .

0 commit comments

Comments
 (0)