-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from octue/fix-contact-form
Fix contact form
- Loading branch information
Showing
21 changed files
with
216 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: add-issues-to-board | ||
|
||
on: | ||
issues: | ||
types: [opened, reopened, transferred] | ||
|
||
jobs: | ||
add-issues-to-board: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Add to Board | ||
uses: actions/add-to-project@v0.5.0 | ||
with: | ||
project-url: https://github.com/orgs/octue/projects/22 | ||
github-token: ${{ secrets.PROJECT_ISSUES_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
name: semantic | ||
|
||
on: [push] | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check-semantic-version: | ||
if: "!contains(github.event.head_commit.message, 'skipci')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Set fetch-depth to 0 to fetch all tags (necessary for git-mkver to determine the correct semantic version). | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v2 | ||
- name: Install git-mkver | ||
run: | | ||
curl -L https://github.com/idc101/git-mkver/releases/download/v1.2.1/git-mkver-linux-amd64-1.2.1.tar.gz \ | ||
| tar xvz \ | ||
&& sudo mv git-mkver /usr/local/bin | ||
- name: Install semantic version checker | ||
run: pip install git+https://github.com/octue/conventional-commits | ||
|
||
- name: Check version | ||
run: check-semantic-version package.json | ||
uses: octue/check-semantic-version@1.0.0.beta-9 | ||
with: | ||
path: package.json | ||
breaking_change_indicated_by: major |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This workflow updates the pull request description with an auto-generated section containing the categorised commit | ||
# message headers of the commits since the last pull request merged into main. The auto generated section is enveloped | ||
# between two comments: "<!--- START AUTOGENERATED NOTES --->" and "<!--- END AUTOGENERATED NOTES --->". Anything | ||
# outside these in the description is left untouched. Auto-generated updates can be skipped for a commit if | ||
# "<!--- SKIP AUTOGENERATED NOTES --->" is added to the pull request description. | ||
|
||
name: update-pull-request | ||
|
||
# Only trigger for pull requests into main branch. | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
description: | ||
if: "!contains(github.event.pull_request.body, '<!--- SKIP AUTOGENERATED NOTES --->')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Generate PR description | ||
uses: octue/generate-pull-request-description@1.0.0.beta-2 | ||
id: pr-description | ||
with: | ||
pull_request_url: ${{ github.event.pull_request.url }} | ||
api_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update pull request body | ||
uses: riskledger/update-pr-description@v2 | ||
with: | ||
body: ${{ steps.pr-description.outputs.pull_request_description }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,3 +76,8 @@ yarn-error.log | |
# Storybook build files | ||
build-storybook.log | ||
storybook-static | ||
|
||
|
||
# IDEs | ||
.idea/ | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import requests | ||
from os import environ | ||
import hashlib | ||
|
||
|
||
# Get list ids: | ||
# resp = requests.get( | ||
# f"{MAILCHIMP_BASE_URL}/lists", auth=("apikey", MAILCHIMP_API_KEY) | ||
# ) | ||
# resp.raise_for_status() | ||
# print(resp.json()['lists'][0]['id']) | ||
MAILCHIMP_LIST_IDS = { | ||
"Octue Newsletter": "cf71ac7a6b", | ||
} | ||
MAILCHIMP_LIST_ID = MAILCHIMP_LIST_IDS["Octue Newsletter"] | ||
|
||
MAILCHIMP_API_KEY = environ.get("MAILCHIMP_API_KEY", None) | ||
MAILCHIMP_SERVER_DOMAIN = environ.get("MAILCHIMP_SERVER_DOMAIN", "us21") | ||
MAILCHIMP_BASE_URL = f"https://{MAILCHIMP_SERVER_DOMAIN}.api.mailchimp.com/3.0" | ||
|
||
if MAILCHIMP_API_KEY is None: | ||
raise ValueError("The MAILCHIMP_API_KEY must be set.") | ||
|
||
|
||
def add_or_update_subscriber(email): | ||
"""Add a subscriber to the main mailchimp list, o if they're already present, update their status to 'subscribed'""" | ||
|
||
endpoint = ( | ||
f"{MAILCHIMP_BASE_URL}/lists/{MAILCHIMP_LIST_ID}/members/{_email_hash(email)}" | ||
) | ||
data = { | ||
"email_address": email, | ||
"status_if_new": "subscribed", | ||
"status": "subscribed", | ||
} | ||
headers = { | ||
"Authorization": f"apikey {MAILCHIMP_API_KEY}", | ||
"Content-Type": "application/json", | ||
} | ||
|
||
response = requests.put(endpoint, json=data, headers=headers, timeout=5) | ||
response.raise_for_status() | ||
|
||
|
||
def _email_hash(email): | ||
"""Generate an MD5 hash of an email address, which is required by the Mailchimp API for identifying the member in the list.""" | ||
return hashlib.md5(email.encode("utf-8")).hexdigest() |
Oops, something went wrong.