Skip to content

Commit

Permalink
ci: add variable for decide run the rest
Browse files Browse the repository at this point in the history
  • Loading branch information
kilee1230 committed Dec 23, 2023
1 parent 5709869 commit 681ab61
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,27 @@ jobs:
matrix:
node-version: [18.x]

outputs:
result: ${{ steps.set-status.outputs.result }}

steps:
- name: Check if it's a repository creation event
id: set-status
run: |
if [ "${{ github.event_name }}" == 'push' ] && [ "${{ github.repository }}" != "${{ github.actor }}/express-api-template" ]; then
echo "Stopping job because it's a repository creation event."
exit 0 # This will exit the script and stop the job
echo "::set-output name=result::failure"
else
echo "Proceeding with the job."
echo "::set-output name=result::success"
fi
- uses: actions/checkout@v4
- name: Checkout code and Use Node.js
if: ${{ needs.build.outputs.result == 'success' }}
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
if: success()
if: ${{ needs.build.outputs.result == 'success' }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
Expand Down

0 comments on commit 681ab61

Please sign in to comment.