-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (75 loc) · 3.8 KB
/
Regridding.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Run Regridding
on:
workflow_run:
workflows: [ "Run all recipes", "Run all failed" ]
types:
- completed
workflow_dispatch:
jobs:
run_recipe:
runs-on: ubuntu-latest
steps:
- name: Get latest workflow run status
uses: actions/github-script@v6
id: latest-workflow-status
with:
script: |
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'Regridding.yml',
per_page: 2
})
return runs.data.workflow_runs[1].conclusion
result-encoding: string
- name: Run Regridding
if: ${{ github.event.workflow_run.name == 'Run all recipes' || ( github.event.workflow_run.name == 'Run all failed' && steps.latest-workflow-status.outputs.result != 'success' ) || github.event_name == 'workflow_dispatch' }}
uses: appleboy/[email protected]
with:
host: gadi.nci.org.au
username: ${{secrets.GADI_USER}}
key: ${{secrets.DEPLOY_KEY}}
passphrase: ${{secrets.DEPLOY_KEY_PASSWORD}}
command_timeout: 2400m
script: |
cd ${{secrets.GADI_SCRIPTS_DIR}}/../COSIMA-recipes/jobs
qsub launch_Regridding.pbs
- name: Get output log
if: ${{ failure() || github.event.workflow_run.name == 'Run all recipes' || ( github.event.workflow_run.name == 'Run all failed' && steps.latest-workflow-status.outputs.result != 'success' ) || github.event_name == 'workflow_dispatch' }}
uses: nicklasfrahm/scp-action@main
with:
direction: download
host: gadi.nci.org.au
username: ${{secrets.GADI_USER}}
insecure_ignore_fingerprint: true
key: ${{secrets.DEPLOY_KEY}}
passphrase: ${{secrets.DEPLOY_KEY_PASSWORD}}
source: ${{secrets.GADI_SCRIPTS_DIR}}/../COSIMA-recipes/logs/Regridding.out
target: log.txt
- name: Upload log as artifact
if: ${{ failure() || github.event.workflow_run.name == 'Run all recipes' || ( github.event.workflow_run.name == 'Run all failed' && steps.latest-workflow-status.outputs.result != 'success' ) || github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v3
with:
name: output_log
path: log.txt
#- name: Create Issue if fails
# if: ${{ failure() }}
# env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
# run: |
# github_id=$(gh api --header "Accept: application/vnd.github+json" --header 'X-GitHub-Api-Version:2022-11-28' --method GET /repos/ACCESS-NRI/COSIMA-recipes-workflow/issues?state=open | jq '.[] | select(.title == "Recipe: Regridding failing") | .number')
# if [ -z "$github_id" ]
# then
# gh api --header "Accept: application/vnd.github+json" --header 'X-GitHub-Api-Version:2022-11-28' --method POST /repos/ACCESS-NRI/COSIMA-recipes-workflow/issues -f title="Recipe: Regridding failing" -f body="Please check log in action workflow"
# #else
# # gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/ACCESS-NRI/COSIMA-recipes-workflow/issues/$github_id/comments -f body="Still failing"
# fi
#- name: Close Issue if success
# env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
# run: |
# github_id=$(gh api --header "Accept: application/vnd.github+json" --header 'X-GitHub-Api-Version:2022-11-28' --method GET /repos/ACCESS-NRI/COSIMA-recipes-workflow/issues?state=open | jq '.[] | select(.title == "Recipe: Regridding failing") | .number')
# if [ ! -z "$github_id" ]
# then
# gh issue close --repo ACCESS-NRI/COSIMA-recipes-workflow $github_id
# fi