Skip to content

Commit

Permalink
to func
Browse files Browse the repository at this point in the history
  • Loading branch information
linroex committed May 1, 2024
1 parent afaea0f commit eae0394
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 39 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/check-status/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Check Status'
description: 'Perform status check and set job outcome'
runs:
using: 'composite'
steps:
- run: |
if [ "${{ inputs.status }}" == "success" ]; then
echo "Status is success."
exit 0
else
echo "Status is failure."
exit 1
fi
shell: bash
inputs:
status:
description: 'Status to check'
required: true
52 changes: 13 additions & 39 deletions .github/workflows/testa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,39 @@ name: Actions-Example

on: [workflow_dispatch]

env:
A: ${{ vars.A }}
B: ${{ vars.B }}
C: ${{ vars.C }}
D: ${{ vars.D }}

jobs:
job-A:
runs-on: ubuntu-latest
steps:
steps:
- name: Check Job A
run: |
if [ "${{ env.A }}" == "success" ]; then
echo "Job A succeeded."
exit 0
else
echo "Job A failed."
exit 1
fi
uses: ./.github/workflows/check-status
with:
status: ${{ vars.A }}

job-B:
runs-on: ubuntu-latest
needs: job-A
continue-on-error: true
steps:
- name: Check Job B
run: |
if [ "${{ env.B }}" == "success" ]; then
echo "Job B succeeded."
exit 0
else
echo "Job B failed."
exit 1
fi
uses: ./.github/workflows/check-status
with:
status: ${{ vars.B }}

job-C:
runs-on: ubuntu-latest
needs: job-B
steps:
- name: Check Job C
run: |
if [ "${{ env.C }}" == "success" ]; then
echo "Job C succeeded."
exit 0
else
echo "Job C failed."
exit 1
fi
uses: ./.github/workflows/check-status
with:
status: ${{ vars.C }}

job-D:
runs-on: ubuntu-latest
needs: job-B
steps:
- name: Check Job D
run: |
if [ "${{ env.D }}" == "success" ]; then
echo "Job D succeeded."
exit 0
else
echo "Job D failed."
exit 1
fi
uses: ./.github/workflows/check-status
with:
status: ${{ vars.D }}

0 comments on commit eae0394

Please sign in to comment.