-
-
Notifications
You must be signed in to change notification settings - Fork 9
58 lines (53 loc) · 1.59 KB
/
Copy pathe2e-desktop-comment.yml
File metadata and controls
58 lines (53 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Trigger desktop E2E tests when someone comments /e2e-desktop on a PR, or manually.
# Calls the reusable e2e-desktop workflow with the PR head ref.
name: E2E Desktop (Comment Trigger)
on:
issue_comment:
types: [created]
workflow_dispatch:
inputs:
pr:
description: PR number to run E2E on (required for manual run)
required: true
type: number
jobs:
check-trigger:
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- name: Check comment trigger
id: check
uses: ./.github/actions/check-comment-trigger
with:
trigger: '/e2e-desktop'
allow_workflow_dispatch: 'true'
get-pr-ref:
needs: check-trigger
if: needs.check-trigger.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
ref: ${{ steps.pr.outputs.sha }}
steps:
- name: Get PR head ref
id: pr
uses: actions/github-script@v7
with:
script: |
const prNumber = context.eventName === 'workflow_dispatch'
? context.payload.inputs.pr
: context.issue.number;
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: Number(prNumber),
});
core.setOutput('sha', pr.data.head.sha);
e2e-desktop:
needs: get-pr-ref
uses: ./.github/workflows/e2e-desktop.yml
with:
ref: ${{ needs.get-pr-ref.outputs.ref }}
secrets: inherit