-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into pr/space-techy/845
- Loading branch information
Showing
44 changed files
with
1,559 additions
and
335 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,22 @@ | ||
chat: | ||
auto_reply: true | ||
code_generation: | ||
docstrings: | ||
language: en-US | ||
early_access: true | ||
language: en-US | ||
reviews: | ||
assess_linked_issues: true | ||
auto_apply_labels: false | ||
auto_review: | ||
enabled: true | ||
drafts: true | ||
collapse_walkthrough: false | ||
high_level_summary: true | ||
high_level_summary_in_walkthrough: true | ||
labeling_instructions: [] | ||
poem: false | ||
profile: chill | ||
request_changes_workflow: false | ||
review_status: true | ||
sequence_diagrams: false |
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
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,37 @@ | ||
name: "Auto Label Issues" | ||
on: | ||
issues: | ||
types: | ||
- edited | ||
- opened | ||
|
||
jobs: | ||
label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Apply Labels to Issues | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
const issue = context.payload.issue; | ||
const keywords = { | ||
"bug": ["error", "failure", "not working"], | ||
"enhancement": ["add", "feature request", "improve"], | ||
"question": ["clarification", "help", "how to"] | ||
}; | ||
let labels = []; | ||
for (const [label, words] of Object.entries(keywords)) { | ||
if (words.some(word => issue.title.toLowerCase().includes(word) || issue.body.toLowerCase().includes(word))) { | ||
labels.push(label); | ||
} | ||
} | ||
if (labels.length > 0) { | ||
github.rest.issues.addLabels({ | ||
issue_number: context.issue.number, | ||
labels: labels, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
} |
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
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
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
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 |
---|---|---|
|
@@ -15,8 +15,6 @@ class Meta: | |
"name", | ||
"description", | ||
"url", | ||
"created_at", | ||
"updated_at", | ||
) | ||
|
||
|
||
|
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,20 @@ | ||
"""OWASP event GraphQL node.""" | ||
|
||
from apps.common.graphql.nodes import BaseNode | ||
from apps.owasp.models.event import Event | ||
|
||
|
||
class EventNode(BaseNode): | ||
"""Event node.""" | ||
|
||
class Meta: | ||
model = Event | ||
fields = ( | ||
"category", | ||
"end_date", | ||
"description", | ||
"key", | ||
"name", | ||
"start_date", | ||
"url", | ||
) |
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
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,17 @@ | ||
"""OWASP event GraphQL queries.""" | ||
|
||
import graphene | ||
|
||
from apps.common.graphql.queries import BaseQuery | ||
from apps.owasp.graphql.nodes.event import EventNode | ||
from apps.owasp.models.event import Event | ||
|
||
|
||
class EventQuery(BaseQuery): | ||
"""Event queries.""" | ||
|
||
upcoming_events = graphene.List(EventNode) | ||
|
||
def resolve_upcoming_events(root, info): | ||
"""Resolve all events.""" | ||
return Event.upcoming_events |
26 changes: 26 additions & 0 deletions
26
backend/apps/owasp/management/commands/owasp_update_events.py
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,26 @@ | ||
"""A command to update OWASP events.""" | ||
|
||
import yaml | ||
from django.core.management.base import BaseCommand | ||
|
||
from apps.github.utils import get_repository_file_content | ||
from apps.owasp.models.event import Event | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Import events from the provided YAML file" | ||
|
||
def handle(self, *args, **kwargs): | ||
data = yaml.safe_load( | ||
get_repository_file_content( | ||
"https://raw.githubusercontent.com/OWASP/owasp.github.io/main/_data/events.yml" | ||
) | ||
) | ||
|
||
Event.bulk_save( | ||
[ | ||
Event.update_data(category["category"], event_data) | ||
for category in data | ||
for event_data in category["events"] | ||
] | ||
) |
Oops, something went wrong.