Skip to content

Commit

Permalink
test that trigger step is skipped but workflow succeeds
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe committed Nov 14, 2024
1 parent 9cb7229 commit a2befaa
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/trigger_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- develop
- main_v**
- 'main_v[0-9]+.[0-9]+'
- main
paths-ignore:
- 'docs/**'
Expand All @@ -23,15 +23,15 @@ jobs:
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
- uses: actions/checkout@v4
with:
repository: 'dtcenter/METplus'
ref: 'develop'
path: 'METplus'
- run: ls $GITHUB_WORKSPACE
- id: get_version
run: |
version=$(python3 -c "from component_name import __version__; print(__version__)")
version=$(cut -d "/" -f3 <<< "${GITHUB_REF}")
echo "version=${version}" >> $GITHUB_OUTPUT
- id: get_metplus_branch
run: |
Expand All @@ -42,23 +42,25 @@ jobs:
cmd="$GITHUB_WORKSPACE/METplus/metplus/component_versions.py -i METplotpy -v ${version} -o METplus -f main_v{X}.{Y}"
echo $cmd
metplus_branch=$($cmd)
if [ -z "$(git -C $GITHUB_WORKSPACE/METplus branch -l ${metplus_branch} --format '%(refname:short)')" ]; then
if [ -z "$(git -C $GITHUB_WORKSPACE/METplus branch -l ${metplus_branch})" ]; then
echo "METplus branch ${metplus_branch} does not exist yet"
exit 1
metplus_branch=none
fi
echo "metplus_branch=${metplus_branch}" >> $GITHUB_OUTPUT
- run: |
- 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}"
# - uses: actions/github-script@v7
# - 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: 'develop',
# ref: ${{ steps.get_metplus_branch.outputs.metplus_branch }},
# inputs: {
# repository: '${{ github.repository }}',
# ref: '${{ github.ref }}',
Expand Down

0 comments on commit a2befaa

Please sign in to comment.