Skip to content

Commit 6c7f7d3

Browse files
Anton StandrikAnton Standrik
authored andcommitted
feat: run tests on main
1 parent 2e74e7e commit 6c7f7d3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Node.js CI
33
on:
44
pull_request:
55
branches: ['**']
6+
push:
7+
branches: ['main']
68
merge_group:
79
types: [checks_requested]
810

@@ -40,7 +42,6 @@ jobs:
4042
e2e_tests:
4143
name: Playwright Tests
4244
runs-on: ubuntu-latest
43-
if: ${{github.event.action != 'checks_requested'}}
4445
permissions:
4546
contents: read
4647

@@ -187,7 +188,7 @@ jobs:
187188
deploy_and_update:
188189
name: Deploy and Update PR
189190
needs: [e2e_tests, bundle_size]
190-
if: ${{always() && github.event.pull_request.head.repo.full_name == github.repository && github.event.action != 'checks_requested'}}
191+
if: ${{always() && (github.ref == 'refs/heads/main' || github.event.pull_request.head.repo.full_name == github.repository)}}
191192
runs-on: ubuntu-latest
192193
permissions:
193194
contents: write
@@ -213,8 +214,13 @@ jobs:
213214

214215
- name: Copy new report
215216
run: |
216-
mkdir -p gh-pages/${{ github.event.pull_request.number }}
217-
cp -r playwright-artifacts/playwright-report/* gh-pages/${{ github.event.pull_request.number }}/
217+
if [ "${{ github.event_name }}" = "pull_request" ]; then
218+
REPORT_DIR="${{ github.event.pull_request.number }}"
219+
else
220+
REPORT_DIR="main"
221+
fi
222+
mkdir -p gh-pages/$REPORT_DIR
223+
cp -r playwright-artifacts/playwright-report/* gh-pages/$REPORT_DIR/
218224
219225
- name: Deploy report to GitHub Pages
220226
uses: peaceiris/actions-gh-pages@v3
@@ -226,6 +232,7 @@ jobs:
226232

227233
- name: Count new tests
228234
id: count_tests
235+
if: github.event_name == 'pull_request'
229236
run: |
230237
git fetch origin main:main
231238
new_tests=0
@@ -253,6 +260,7 @@ jobs:
253260
echo "new_tests=$new_tests" >> $GITHUB_OUTPUT
254261
255262
- name: Update PR description
263+
if: github.event_name == 'pull_request'
256264
uses: actions/github-script@v6
257265
with:
258266
github-token: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)