Skip to content

Commit

Permalink
fix: skip unnecessary test runs for bot-generated and non-critical PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaP700 authored Jan 23, 2025
1 parent f19960d commit 72756af
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/pr-testing-with-test-project.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
#This workflow runs the tests in the test projects to make sure the generator works as a library where it is a Node dependency along with the template.
name: Test using test project

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- 'package.json'
- 'package-lock.json'
- 'apps/'
- 'packages/'
- '.github/workflows/'
- '!/*.md'
- '!docs/**'

jobs:
should-test:
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.check.outputs.run_tests }}
steps:
- name: Check if tests should run
id: check
run: |
# Skip for bot PRs with specific titles
if [[ "${{ github.actor }}" == "asyncapi-bot" && "${{ github.event.pull_request.title }}" =~ ^(ci:\ update|chore\(release\):) ]] || \
[[ "${{ github.actor }}" == "allcontributors[bot]" && "${{ github.event.pull_request.title }}" =~ ^docs: ]]; then
echo "run_tests=false" >> $GITHUB_OUTPUT
else
echo "run_tests=true" >> $GITHUB_OUTPUT
fi
test:
if: github.event.pull_request.draft == false
needs: should-test
if: needs.should-test.outputs.run_tests == 'true' && github.event.pull_request.draft == false
name: Test generator as dependency with Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
Expand All @@ -16,6 +40,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run test
run: NODE_IMAGE_TAG=${{ matrix.node }} docker compose up --abort-on-container-exit --remove-orphans --force-recreate
working-directory: ./apps/generator/test/test-project

0 comments on commit 72756af

Please sign in to comment.