-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (74 loc) · 2.77 KB
/
trigger_main.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
name: Trigger METplus Workflow
on:
push:
branches:
- develop
- 'main_v[0-9]+.[0-9]+'
- main
paths-ignore:
- 'docs/**'
- '.github/pull_request_template.md'
- '.github/ISSUE_TEMPLATE/**'
- '**/README.md'
- '**/LICENSE.md'
jobs:
trigger_metplus:
name: Trigger METplus testing workflow
runs-on: ubuntu-latest
steps:
- name: Print GitHub values for reference
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v4
# get the develop branch of METplus to get the latest component version script
# use fetch-depth 0 to get all branches
- uses: actions/checkout@v4
with:
repository: 'dtcenter/METplus'
ref: 'develop'
path: 'METplus'
fetch-depth: 0
- id: get_version
run: |
version=$(cut -d "/" -f3 <<< "${GITHUB_REF}")
echo "version=${version}" >> $GITHUB_OUTPUT
- id: get_metplus_branch
run: |
repo=${{ github.repository }}
repo=${repo#*/}
version=${{ steps.get_version.outputs.version }}
cmd="$GITHUB_WORKSPACE/METplus/metplus/component_versions.py -i METplotpy -v ${version} -o METplus -f main_v{X}.{Y}"
echo $cmd
metplus_branch=$($cmd)
echo git -C $GITHUB_WORKSPACE/METplus branch -l ${metplus_branch}
git --version
branch_exists=$(git -C $GITHUB_WORKSPACE/METplus branch -l ${metplus_branch})
echo branch exists: ${branch_exists}
if [ -z "${branch_exists}" ]; then
echo "METplus branch ${metplus_branch} does not exist yet"
metplus_branch=none
fi
echo "metplus_branch=${metplus_branch}" >> $GITHUB_OUTPUT
- if: ( steps.get_metplus_branch.outputs.metplus_branch != 'none' )
run: |
metplus_branch=${{ steps.get_metplus_branch.outputs.metplus_branch }}
echo "Triggering workflow dispatch of ${metplus_branch}"
# - if: ( steps.get_metplus_branch.outputs.metplus_branch != 'none' )
# uses: actions/github-script@v7
# with:
# github-token: ${{ secrets.METPLUS_BOT_TOKEN }}
# script: |
# await github.rest.actions.createWorkflowDispatch({
# owner: 'dtcenter',
# repo: 'METplus',
# workflow_id: 'testing.yml',
# ref: ${{ steps.get_metplus_branch.outputs.metplus_branch }},
# inputs: {
# repository: '${{ github.repository }}',
# ref: '${{ github.ref }}',
# actor: '${{ github.actor }}',
# sha: '${{ github.sha }}',
# pusher_email: '${{ github.event.pusher.email }}'
# },
# });