-
Notifications
You must be signed in to change notification settings - Fork 46
64 lines (56 loc) · 2.41 KB
/
submit-suggested-spec.yml
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
59
60
61
62
63
64
name: Create a PR for the suggested spec
on:
issue_comment:
# Details for types below can be found at:
# https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads?actionType=edited#issues
types:
# Job triggered when an issue comment is created (or edited)
- created
- edited
jobs:
prepare:
name: Create pull request if needed
runs-on: ubuntu-latest
# TODO: Check comment user permissions more thoroughly, for instance using
# the REST API (see link below). This is going to be needed if we decide to
# remove the PR step and have the bot merge directly to the `main` branch.
# https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28#get-repository-permissions-for-a-user
if: ${{ github.event.comment.author_association == 'MEMBER' && contains(github.event.comment.body, '@browser-specs-bot ') }}
steps:
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
- name: Install dependencies
run: npm ci
- name: Setup git
run: |
git config user.name "browser-specs-bot"
git config user.email "<>"
git remote set-url --push origin https://x-access-token:[email protected]/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- name: Add suggested spec to specs.json
if: ${{ contains(github.event.comment.body, '@browser-specs-bot pr') }}
run: npx browser-specs build $NUMBER --pr
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
NUMBER: ${{ github.event.issue.number }}
- name: Monitor suggested spec
if: ${{ contains(github.event.comment.body, '@browser-specs-bot monitor') }}
run: npx browser-specs monitor $NUMBER $COMMENT --pr
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
NUMBER: ${{ github.event.issue.number }}
COMMENT: ${{ github.event.comment.id }}
- name: Ignore suggested spec
if: ${{ contains(github.event.comment.body, '@browser-specs-bot ignore') }}
run: npx browser-specs ignore $NUMBER $COMMENT --pr
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
NUMBER: ${{ github.event.issue.number }}
COMMENT: ${{ github.event.comment.id }}