Skip to content

Commit 6a4bc13

Browse files
authored
Transferred from old repo (#647)
1 parent d1c1cb2 commit 6a4bc13

16 files changed

+3592
-50
lines changed

.github/ISSUE_TEMPLATE/edit_role.yaml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Edit Role
2+
description: Edit a Job Posting on our list
3+
title: "Editing Role"
4+
labels: ["edit_role"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
## Edit Job Posting Form
10+
Thanks for taking the time to contribute!
11+
Make sure you've read `CONTRIBUTING.md` before submitting your edits
12+
Please only fill in **link, reason, and whichever fields you would like to edit**
13+
You may leave the others empty
14+
- type: input
15+
id: url
16+
attributes:
17+
label: Link to Job Posting
18+
placeholder: ex. example.com/link/to/posting
19+
validations:
20+
required: true
21+
- type: input
22+
id: company_name
23+
attributes:
24+
label: Company Name
25+
placeholder: ex. Google
26+
validations:
27+
required: false
28+
- type: input
29+
id: title
30+
attributes:
31+
label: Job Title
32+
placeholder: ex. ML Software Engineer
33+
validations:
34+
required: false
35+
- type: input
36+
id: location
37+
attributes:
38+
label: Location
39+
description: |
40+
Where is the job located?
41+
Please separate locations with a pipe "|" if there are multiple options.
42+
Include Remote if remote option available.
43+
placeholder: ex. San Franciso, CA | Austin, TX | Remote
44+
validations:
45+
required: false
46+
- type: dropdown
47+
id: sponsorship
48+
attributes:
49+
label: Does this job offer sponsorship?
50+
description: |
51+
If the posting does not fall into one of these
52+
categories, select "Other" then specify in parentheses at the end of
53+
the Job Title what the sponsorship status is
54+
multiple: false
55+
options:
56+
- Offers Sponsorship
57+
- Does Not Offer Sponsorship
58+
- U.S. Citizenship is Required
59+
- Other
60+
validations:
61+
required: false
62+
- type: dropdown
63+
id: active
64+
attributes:
65+
label: Is this job posting currently accepting applications?
66+
multiple: false
67+
options:
68+
- "Yes"
69+
- "No"
70+
validations:
71+
required: false
72+
- type: checkboxes
73+
id: is_visible
74+
attributes:
75+
label: Remove this job from the list?
76+
description: Only check this box if this job is fake, does not fit the theme of the repo, or is offensive.
77+
options:
78+
- label: "Yes, remove this job"
79+
- type: input
80+
id: email
81+
attributes:
82+
label: Email associated with your GitHub account (Optional)
83+
description: |
84+
If you would like to be listed as the contributor to the repository when our github action
85+
commits your contribution to the repo, please provide your email. This is the only time your
86+
email will be used. If left blank, your contribution will still be made, but it will be made
87+
by the bot [email protected].
88+
placeholder: ex. [email protected]
89+
validations:
90+
required: false
91+
- type: textarea
92+
id: reason
93+
attributes:
94+
label: Reason for edit
95+
description: If the reason for your edit is not obvious, please explain here.
96+
placeholder: This job is no longer accepting applications...
97+
validations:
98+
required: false
99+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: New Feature Request
2+
description: Submit your ideas for improvements to the repo!
3+
title: "New Feature Request"
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to suggest a new feature or improvement
10+
- type: textarea
11+
id: improvement
12+
attributes:
13+
label: Improvement
14+
placeholder: ex. I think the repo should be more colorful...
15+
validations:
16+
required: true

.github/ISSUE_TEMPLATE/misc.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Miscellaneous Issue
2+
description: Ask us a question or tell us what we could do better
3+
title: "Misc Issue"
4+
labels: ["misc"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to give us feedback
10+
- type: textarea
11+
id: misc
12+
attributes:
13+
label: Issue/Question
14+
description: Ask us a question or tell us what we could do better
15+
placeholder: ex. There are a few jobs that aren't actually technical...
16+
validations:
17+
required: true

.github/ISSUE_TEMPLATE/new_role.yaml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: New Role
2+
description: Contribute a Job Posting to our list
3+
title: "New Role"
4+
labels: ["new_role"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
## New Job Posting Contribution Form
10+
Thanks for taking the time to contribute!
11+
> Make sure you've read `CONTRIBUTING.md` before submitting your internship
12+
- type: input
13+
id: url
14+
attributes:
15+
label: Link to Job Posting
16+
placeholder: ex. example.com/link/to/posting
17+
validations:
18+
required: true
19+
- type: input
20+
id: company_name
21+
attributes:
22+
label: Company Name
23+
placeholder: ex. Google
24+
validations:
25+
required: true
26+
- type: input
27+
id: title
28+
attributes:
29+
label: Job Title
30+
placeholder: ex. ML Software Engineer
31+
validations:
32+
required: true
33+
- type: input
34+
id: location
35+
attributes:
36+
label: Location
37+
description: |
38+
Where is the job located?
39+
Please separate locations with a pipe "|" if there are multiple options.
40+
Include Remote if remote option available.
41+
placeholder: San Franciso, CA | Austin, TX | Remote
42+
validations:
43+
required: true
44+
- type: dropdown
45+
id: sponsorship
46+
attributes:
47+
label: Does this job offer sponsorship?
48+
description: |
49+
If the posting does not fall into one of these
50+
categories, select "Other" then specify in parentheses at the end of
51+
the Internship Title what the sponsorship status is
52+
multiple: false
53+
options:
54+
- Offers Sponsorship
55+
- Does Not Offer Sponsorship
56+
- U.S. Citizenship is Required
57+
- Other
58+
validations:
59+
required: true
60+
- type: dropdown
61+
id: active
62+
attributes:
63+
label: Is this internship currently accepting applications?
64+
multiple: false
65+
options:
66+
- "Yes"
67+
- "No"
68+
validations:
69+
required: true
70+
- type: input
71+
id: email
72+
attributes:
73+
label: Email associated with your GitHub account (Optional)
74+
description: |
75+
If you would like to be listed as the contributor to the repository when our github action
76+
commits your contribution to the repo, please provide your email. This is the only time your
77+
email will be used. If left blank, your contribution will still be made, but it will be made
78+
by the bot [email protected].
79+
placeholder: ex. [email protected]
80+
validations:
81+
required: false
82+
- type: textarea
83+
id: reason
84+
attributes:
85+
label: Extra Notes (Optional)
86+
description: |
87+
Optionally, you may provide extra context/insights to our team about the job.
88+
This will not be shown anywhere on the repo, but might ensure your contribution is accepted.
89+
placeholder: This is an exciting new company in the vr space...
90+
validations:
91+
required: false

.github/pull_request_template.md

-10
This file was deleted.
Binary file not shown.
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
import sys
2+
import json
3+
import subprocess
4+
import sys
5+
import uuid
6+
from datetime import datetime
7+
import os
8+
import util
9+
import re
10+
11+
12+
def add_https_to_url(url):
13+
if not url.startswith(("http://", "https://")):
14+
url = "https://" + url
15+
return url
16+
17+
18+
def getData(body, is_edit, username):
19+
data = {}
20+
lines = [text.strip("# ") for text in re.split('[\n\r]+', body)]
21+
#["Company Name", "_No response_", "Internship Title", "_No response_", "Link to Internship Posting", "example.com/link/to/posting", "Locatio", "San Franciso, CA | Austin, TX | Remote" ,"What term(s) is this internship offered for?", "_No response_"]
22+
23+
data["date_updated"] = int(datetime.now().timestamp())
24+
25+
if "no response" not in lines[1].lower():
26+
data["url"] = add_https_to_url(lines[1].strip())
27+
if "no response" not in lines[3].lower():
28+
data["company_name"] = lines[3]
29+
if "no response" not in lines[5].lower():
30+
data["title"] = lines[5]
31+
if "no response" not in lines[7].lower():
32+
data["locations"] = [line.strip() for line in lines[7].split("|")]
33+
if "no response" not in lines[9].lower():
34+
data["sponsorship"] = "Other"
35+
for option in ["Offers Sponsorship", "Does Not Offer Sponsorship", "U.S. Citizenship is Required"]:
36+
if option in lines[9]:
37+
data["sponsorship"] = option
38+
if "none" not in lines[11].lower():
39+
data["active"] = "yes" in lines[11].lower()
40+
if is_edit:
41+
data["is_visible"] = "[x]" not in lines[13].lower()
42+
43+
email = lines[15 if is_edit else 13].lower()
44+
if "no response" not in email:
45+
util.setOutput("commit_email", email)
46+
util.setOutput("commit_username", username)
47+
else:
48+
util.setOutput("commit_email", "[email protected]")
49+
util.setOutput("commit_username", "GitHub Action")
50+
51+
return data
52+
53+
54+
def main():
55+
event_file_path = sys.argv[1]
56+
57+
with open(event_file_path) as f:
58+
event_data = json.load(f)
59+
60+
61+
# CHECK IF NEW OR OLD INTERNSHIP
62+
63+
new_role = "new_role" in [label["name"] for label in event_data["issue"]["labels"]]
64+
edit_role = "edit_role" in [label["name"] for label in event_data["issue"]["labels"]]
65+
66+
if not new_role and not edit_role:
67+
util.fail("Only new_role and edit_role issues can be approved")
68+
69+
70+
# GET DATA FROM ISSUE FORM
71+
72+
issue_body = event_data['issue']['body']
73+
issue_user = event_data['issue']['user']['login']
74+
75+
data = getData(issue_body, is_edit=edit_role, username=issue_user)
76+
77+
if new_role:
78+
data["source"] = issue_user
79+
data["id"] = str(uuid.uuid4())
80+
data["date_posted"] = int(datetime.now().timestamp())
81+
data["company_url"] = ""
82+
data["is_visible"] = True
83+
84+
# remove utm-source
85+
utm = data["url"].find("?utm_source")
86+
if utm == -1:
87+
utm = data["url"].find("&utm_source")
88+
if utm != -1:
89+
data["url"] = data["url"][:utm]
90+
91+
92+
# UPDATE LISTINGS
93+
94+
listings = []
95+
with open(".github/scripts/listings.json", "r") as f:
96+
listings = json.load(f)
97+
98+
listing_to_update = next(
99+
(item for item in listings if item["url"] == data["url"]), None)
100+
if listing_to_update:
101+
if new_role:
102+
util.fail("This role is already in our list. See CONTRIBUTING.md for how to edit a listing")
103+
for key, value in data.items():
104+
listing_to_update[key] = value
105+
106+
util.setOutput("commit_message", "updated listing: " + listing_to_update["title"] + " at " + listing_to_update["company_name"])
107+
else:
108+
if edit_role:
109+
util.fail("We could not find this role in our list. Please double check you inserted the right url")
110+
listings.append(data)
111+
util.setOutput("commit_message", "added listing: " + data["title"] + " at " + data["company_name"])
112+
113+
with open(".github/scripts/listings.json", "w") as f:
114+
f.write(json.dumps(listings, indent=4))
115+
116+
117+
if __name__ == "__main__":
118+
main()

0 commit comments

Comments
 (0)