Skip to content

Commit d9d45ed

Browse files
authored
Change workflow to handle pull requests for bug reproduction
Updated workflow to trigger on pull requests instead of issues, adjusted environment variables, and modified artifact handling.
1 parent 056368f commit d9d45ed

1 file changed

Lines changed: 25 additions & 20 deletions

File tree

.github/workflows/repro-bug.yml

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Bug Reproduction Video
22

33
on:
4-
issues:
4+
pull_request:
55
types:
66
- labeled
77

@@ -17,20 +17,23 @@ env:
1717
SOLUTION_FILE: DevBetterWeb.slnx
1818
PROJECT_FILE: src/DevBetterWeb.Web/DevBetterWeb.Web.csproj
1919

20-
APP_URL: https://localhost:5001
21-
APP_STARTUP_COMMAND: dotnet run --project src/Web/Web.csproj
20+
APP_URL: http://127.0.0.1:5010
21+
APP_STARTUP_COMMAND: dotnet run --project src/DevBetterWeb.Web/DevBetterWeb.Web.csproj --no-build --launch-profile "DevBetterWeb.Web - DEV"
2222

2323
jobs:
2424
reproduce-bug:
2525
if: github.event.label.name == 'bug'
2626
runs-on: ubuntu-latest
2727
timeout-minutes: 30
28+
concurrency:
29+
group: repro-bug-pr-${{ github.event.pull_request.number }}
30+
cancel-in-progress: true
2831

2932
env:
30-
ISSUE_TITLE: ${{ github.event.issue.title }}
31-
ISSUE_BODY: ${{ github.event.issue.body }}
32-
ISSUE_NUMBER: ${{ github.event.issue.number }}
33-
ISSUE_URL: ${{ github.event.issue.html_url }}
33+
ISSUE_TITLE: ${{ github.event.pull_request.title }}
34+
ISSUE_BODY: ${{ github.event.pull_request.body }}
35+
ISSUE_NUMBER: ${{ github.event.pull_request.number }}
36+
ISSUE_URL: ${{ github.event.pull_request.html_url }}
3437
REPO_NAME: ${{ github.repository }}
3538

3639
steps:
@@ -47,6 +50,12 @@ jobs:
4750
with:
4851
dotnet-version: ${{ env.DOTNET_VERSION }}
4952

53+
- name: Initialize Playwright project
54+
run: |
55+
npm init -y
56+
npm install @playwright/test wait-on
57+
npx playwright install --with-deps
58+
5059
- name: Restore .NET dependencies
5160
run: |
5261
if [ -n "${SOLUTION_FILE}" ] && [ -f "${SOLUTION_FILE}" ]; then
@@ -69,18 +78,12 @@ jobs:
6978
7079
- name: Start application
7180
run: |
72-
${APP_STARTUP_COMMAND} &
81+
${APP_STARTUP_COMMAND} > app.log 2>&1 &
7382
echo $! > app.pid
7483
7584
- name: Wait for application startup
7685
run: |
77-
npx wait-on "${APP_URL}"
78-
79-
- name: Initialize Playwright project
80-
run: |
81-
npm init -y
82-
npm install @playwright/test wait-on
83-
npx playwright install --with-deps
86+
npx wait-on "${APP_URL}" --timeout 120000
8487
8588
- name: Generate reproduction script
8689
run: |
@@ -95,7 +98,7 @@ jobs:
9598
screenshot: 'only-on-failure'
9699
});
97100
98-
test('attempt reproduction from github issue', async ({ page }) => {
101+
test('attempt reproduction from github pull request', async ({ page }) => {
99102
await page.goto(process.env.APP_URL, {
100103
waitUntil: 'networkidle'
101104
});
@@ -118,13 +121,15 @@ jobs:
118121
if: always()
119122
uses: actions/upload-artifact@v4
120123
with:
121-
name: repro-artifacts-issue-${{ github.event.issue.number }}
124+
name: repro-artifacts-pr-${{ github.event.pull_request.number }}
122125
path: |
126+
app.log
123127
test-results
124128
playwright-report
129+
if-no-files-found: warn
125130
retention-days: 14
126131

127-
- name: Comment on issue with artifact link
132+
- name: Comment on PR with artifact link
128133
if: always()
129134
uses: actions/github-script@v7
130135
with:
@@ -136,7 +141,7 @@ jobs:
136141
const body = `
137142
🤖 Automated reproduction attempt completed.
138143
139-
## Issue
144+
## Pull Request
140145
#${process.env.ISSUE_NUMBER}
141146
142147
## Configuration
@@ -158,7 +163,7 @@ jobs:
158163
await github.rest.issues.createComment({
159164
owner: context.repo.owner,
160165
repo: context.repo.repo,
161-
issue_number: context.issue.number,
166+
issue_number: context.payload.pull_request.number,
162167
body
163168
});
164169

0 commit comments

Comments
 (0)