Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/alert-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Alert on PR Changes

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

jobs:
alert:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install requests
run: |
python -m pip install --upgrade pip
pip install requests
- name: Send Slack alert on PR changes
env:
SLACK_WEBHOOK: ${{ secrets.DEVEX_ALERTS_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
import requests, os
repo = os.environ.get('GITHUB_REPOSITORY')
pr_number = os.environ.get('PR_NUMBER')
token = os.environ.get('GITHUB_TOKEN')
api_url = f"https://api.github.com/repos/{repo}/pulls/{pr_number}"
headers = {'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json'}
pr_resp = requests.get(api_url, headers=headers)
branch_name = os.environ.get('GITHUB_HEAD_REF', '')
if pr_resp.status_code == 200:
pr_data = pr_resp.json()
pr_title = pr_data.get('title', '')
pr_body = pr_data.get('body', '')
pr_user = pr_data.get('user', {}).get('login', '')
pr_url = pr_data.get('html_url', '')
message = f"PR Alert!\nTitle: {pr_title}\nBranch: {branch_name}\nAuthor: {pr_user}\nURL: {pr_url}\nDescription: {pr_body}"
else:
message = f"PR Alert!\nUnable to fetch PR details.\nStatus Code: {pr_resp.status_code}\nResponse: {pr_resp.text}"
webhook = os.environ['SLACK_WEBHOOK']
requests.post(webhook, json={"text": message})
shell: python
34 changes: 34 additions & 0 deletions yaml/couchbase.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being used anywhere?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, It was just an example which I made in the starting to understand about yaml and was trying to understand different different things. It's not needed. Should I just remove this file, if it's okay with you?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes remove it please.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Search terms (required). Results are a logical OR of all terms.
terms: couchbase OR couchbasevectorstore

summary_term: couchbase

search_in: post

# Maximum number of results (optional, default 100, max 1000)
max_results: 1000

# Exclusion filters (optional). All excluded fields are lists.
excluded_repos: null

excluded_users:
- /.*bot.*/

excluded_orgs:
- couchbase
- Couchbase-Ecosystem
- couchbase-partners
- couchbaselabs
- couchbase-examples
- couchbasecloud
- couchbase-starter-kit

# Date range filters (optional, format: YYYY-MM-DD)
date_from: '-P1D'
date_to: 'today'

# Issue-specific filters (only used when search_type is 'issues')
state: null
is_pr: false
labels: null # is a list of labels
date_type: updated