Skip to content

Commit

Permalink
ci: change to use $github_state
Browse files Browse the repository at this point in the history
  • Loading branch information
kilee1230 committed Dec 23, 2023
1 parent ea8a44b commit bcc67d1
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,36 @@ 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."
echo "::save-state name=result::failure"
echo "skip_ci=true" >> $GITHUB_STATE
else
echo "Proceeding with the job."
echo "::save-state name=result::success"
echo "skip_ci=false" >> $GITHUB_STATE
fi
- name: Checkout code and Use Node.js
if: ${{ needs.build.outputs.result == 'success' }}
if: ${{ skip_ci == 'false' }}
uses: actions/checkout@v4

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

- name: Install dependencies
if: ${{ needs.build.outputs.result == 'success' }}
if: ${{ skip_ci == 'false' }}
run: yarn install

- name: Lint
if: ${{ needs.build.outputs.result == 'success' }}
if: ${{ skip_ci == 'false' }}
run: yarn lint

- name: Test and Coverage
if: ${{ needs.build.outputs.result == 'success' }}
if: ${{ skip_ci == 'false' }}
run: yarn test:coverage

0 comments on commit bcc67d1

Please sign in to comment.