-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (61 loc) · 2.86 KB
/
validate-session.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
65
66
67
68
69
70
71
72
73
name: Validate breakout session issue
on:
issues:
# 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 is created or re-opened
- opened
- reopened
# or gets "edited" (title or body updated)
- edited
jobs:
validate-session:
name: Validate breakout session
runs-on: ubuntu-latest
# We're only interested in "session" issues
if: ${{ contains(github.event.issue.labels.*.name, 'session') }}
steps:
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Checkout latest version of release script
uses: actions/checkout@v3
with:
ref: main
- name: Install dependencies
run: npm ci
- name: Add issue to TPAC breakout session project
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
uses: actions/add-to-project@v0.5.0
with:
# Note: This isn't really necessary since we already made sure that
# issue is a "session" issue
labeled: session
# URL of the annual TPAC XXXX breakout project.
# The PROJECT_OWNER and PROJECT_NUMBER variables must be defined on
# the repository. PROJECT_OWNER_TYPE needs to be set to "user" if
# project belongs to a user. It may be omitted otherwise (or set to
# 'org"').
project-url: https://github.com/${{vars.PROJECT_OWNER_TYPE || 'org'}}s/${{vars.PROJECT_OWNER || 'w3c'}}/projects/${{vars.PROJECT_NUMBER}}
# A valid Personal Access Token (classic version) with project scope
# (and public_repo scope so that labels may be updated) needs to be
# added as secret to the repo, because the action uses the GraphQL
# API under the hoods.
github-token: ${{ secrets.GRAPHQL_TOKEN }}
- name: Dump changes to local file
run: echo '${{ toJSON(github.event.issue.changes || '{}') }}' > changes.json
shell: bash
- name: Validate session and update issue labels accordingly
run: node tools/validate-session.mjs ${{ github.event.issue.number }} changes.json
env:
# See above for PROJECT_XX variables
PROJECT_OWNER: ${{ vars.PROJECT_OWNER_TYPE || 'organization' }}/${{ vars.PROJECT_OWNER || 'w3c' }}
PROJECT_NUMBER: ${{ vars.PROJECT_NUMBER }}
# Same valid Personal Access Token (classic version) as above, with
# project and public_repo scope.
GRAPHQL_TOKEN: ${{ secrets.GRAPHQL_TOKEN }}
# Mapping between chair GitHub identities and W3C IDs must be stored
# in a variable. Structure is a JSON object with identities as keys.
CHAIR_W3CID: ${{ vars.CHAIR_W3CID }}