mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
### **PR Type** Enhancement ___ ### **Description** - Centralize features in JSON registry - Refactor ComparisonTable to load from registry - Add GitHub Action for auto-updating features.json - Update Slack PR notification configuration - Enable JSON module imports in tsconfig ___ ### Diagram Walkthrough ```mermaid flowchart LR PRDesc["PR description feature section"] AutoUpdate["Auto-update features.json Workflow"] featuresJSON["features.json"] featuresTS["features.ts registry"] TableComp["FeatureComparisonTable.vue"] PRDesc -- "triggers" --> AutoUpdate AutoUpdate -- "updates" --> featuresJSON featuresJSON -- "loaded by" --> featuresTS featuresTS -- "used by" --> TableComp ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>features.ts</strong><dd><code>Add central feature registry and helper functions</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-232fb84d995004ab5e3da68e3a9fc835808f460feb9f4478dca50ea4a48ed057">+104/-0</a> </td> </tr> <tr> <td><strong>FeatureComparisonTable.vue</strong><dd><code>Refactor table to load features from registry</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-450bc4b412ffde37d04f96046199090e3d41face1ee85b32e446c9b470ce299e">+31/-30</a> </td> </tr> </table></details></td></tr><tr><td><strong>Configuration changes</strong></td><td><details><summary>6 files</summary><table> <tr> <td><strong>auto-update-features.yml</strong><dd><code>Add workflow to auto-update features.json</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-7179e615740ebfe7a08143d567c20bdf7d813506f77c6efba463d105b48379ad">+253/-0</a> </td> </tr> <tr> <td><strong>pr-slack.yml</strong><dd><code>Update Slack action with new webhook syntax</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-c049020d06d481f16942b242608c22fa8377924730787f97288e03561768f51a">+3/-3</a> </td> </tr> <tr> <td><strong>features.json</strong><dd><code>Add JSON-based features configuration</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-f3c3ea1b3f6e34a0718bced5c01c09bfe13b5ba7936ee8b77eb66b8c14767d49">+262/-0</a> </td> </tr> <tr> <td><strong>features.schema.json</strong><dd><code>Add JSON schema for features.json validation</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-42009a609f9d2eb5a6a7264d7c236ef538fd624f29edf02759bd3b231453be27">+71/-0</a> </td> </tr> <tr> <td><strong>tsconfig.app.json</strong><dd><code>Enable JSON module imports in app config</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-1fc2dc23685a64f037b0063bf18fc420a8faeb83e98a2cc2b407f1a25c4fc1f5">+1/-0</a> </td> </tr> <tr> <td><strong>tsconfig.json</strong><dd><code>Enable JSON module imports in base tsconfig</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/10010/files#diff-0dafb2d38c20327f4a74c03733790ccca87a4bbda69ec4c03aa362524b0522ca">+1/-0</a> </td> </tr> </table></details></td></tr></tr></tbody></table> </details> ___
64 lines
2.3 KiB
YAML
64 lines
2.3 KiB
YAML
name: Notify Slack on stale PRs
|
|
permissions:
|
|
contents: read
|
|
on:
|
|
schedule:
|
|
- cron: "0 11 * * *" # everyday at 11AM
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
notify:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Get PRs older than 7 days
|
|
uses: actions/github-script@v6
|
|
id: stale-prs
|
|
with:
|
|
script: |
|
|
const sevenDaysAgo = new Date();
|
|
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
|
|
const dateString = sevenDaysAgo.toISOString().split('T')[0];
|
|
|
|
const resp = await github.rest.search.issuesAndPullRequests({
|
|
q: `repo:${{ github.repository }} is:pr is:open created:<${dateString}`,
|
|
sort: 'created',
|
|
order: 'asc',
|
|
per_page: 100
|
|
});
|
|
|
|
const prs = resp.data.items.map(pr => {
|
|
const createdDate = new Date(pr.created_at);
|
|
const daysOld = Math.floor((new Date() - createdDate) / (1000 * 60 * 60 * 24));
|
|
return {
|
|
number: pr.number,
|
|
title: pr.title,
|
|
user: pr.user.login,
|
|
daysOld: daysOld
|
|
};
|
|
});
|
|
|
|
core.setOutput("prs", JSON.stringify(prs));
|
|
|
|
- name: Build Slack message
|
|
id: slack-msg
|
|
run: |
|
|
PRS=$(echo '${{ steps.stale-prs.outputs.prs }}' | jq -r '.[] | "- <https://github.com/${{ github.repository }}/pull/\(.number)|#\(.number) \(.title)> — @\(.user) (_\(.daysOld) days old_)"')
|
|
PR_COUNT=$(echo '${{ steps.stale-prs.outputs.prs }}' | jq '. | length')
|
|
if [ "$PR_COUNT" -eq 0 ]; then
|
|
MESSAGE="✅ *No stale PRs in ${{ github.repository }}*\n\nAll PRs are less than 7 days old!"
|
|
else
|
|
MESSAGE="🔔 *Pull Requests older than 7 days in ${{ github.repository }}*\n\n$PRS"
|
|
fi
|
|
# Escape for JSON and create the payload
|
|
PAYLOAD=$(jq -n --arg msg "$MESSAGE" '{text: $msg}')
|
|
echo "payload<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$PAYLOAD" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Send Slack notification
|
|
uses: slackapi/slack-github-action@v2.1.1
|
|
with:
|
|
webhook: ${{ secrets.STALE_PR_SLACK_NOTIFICATION }}
|
|
webhook-type: incoming-webhook
|
|
payload: ${{ steps.slack-msg.outputs.payload }} |