generated from w3c/wai-resource-template
-
Notifications
You must be signed in to change notification settings - Fork 9
49 lines (41 loc) · 1.95 KB
/
process-form-submission.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
# Github action triggered as webhook from a netlify function
# NB!!!! this MUST be on the branch set as GitHub's default if it is to be triggered
name: Process Form Submission
on:
repository_dispatch:
types: [form-submission]
jobs:
process-submission:
name: Process Form
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add new file to workspace
run: "jq '.client_payload.form' $GITHUB_EVENT_PATH > _data/$REPOSITORY/submissions/$SUBMISSION_REF.json"
env:
SUBMISSION_REF: ${{ github.event.client_payload.form.submission_ref }}
REPOSITORY: ${{ github.event.client_payload.form.repository }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
commit-message: Add form submission
committer: GitHub <[email protected]>
author: Form process <[email protected]>
signoff: false
branch: form-submission/${{ github.event.client_payload.form.submission_ref }}
branch-suffix: random # handle concurrent submissions of same form id
delete-branch: true
title: "New form submission '${{ github.event.client_payload.form.form_name }}' - ${{ github.event.client_payload.form.submission_ref }}"
body: |
New form submission:
- form_name: ${{ github.event.client_payload.form.form_name }}
- form_version: ${{ github.event.client_payload.form.form_version }}
- submission_ref: ${{ github.event.client_payload.form.submission_ref }}
- submission_date: ${{ github.event.client_payload.form.submission_date }}
View the submitted JSON in the "Files changed" tab above.
Merge this PR to add the submission to `_data/${{ github.event.client_payload.form.repository }}/submissions`.
labels: |
form submission
automated pr
draft: false