feat(ci): notify Telegram when a pull request is opened#77
Conversation
✅ Deploy Preview for develop-devlovers ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughA GitHub Actions workflow file was added to send Telegram notifications when pull requests are opened. The workflow runs on ubuntu-latest, uses the appleboy/telegram-action@v1.0.1 action, and includes PR metadata such as repository, author, title, branches, and link in the notification message. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/telegram-pr-opened.yml (2)
16-25: Message format is well-structured and informative!The notification message includes all relevant PR information with clear formatting. The use of emojis enhances readability.
Optionally, you could use
github.event.pull_request.user.logininstead ofgithub.actorfor more explicit author identification:🔎 Optional refinement for author field
- 👤 Author: ${{ github.actor }} + 👤 Author: ${{ github.event.pull_request.user.login }}This is more explicit, though both should yield the same result for the
openedevent.
11-12: Consider adding error handling for resilience.If a Telegram notification failure shouldn't block PR workflows, consider adding
continue-on-error: trueto the step.🔎 Optional error handling
- name: Send Telegram message + continue-on-error: true uses: appleboy/telegram-action@v1.0.1This ensures that if the Telegram service is temporarily unavailable, it won't prevent PR processing.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/telegram-pr-opened.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Redirect rules - develop-devlovers
- GitHub Check: Header rules - develop-devlovers
- GitHub Check: Pages changed - develop-devlovers
🔇 Additional comments (1)
.github/workflows/telegram-pr-opened.yml (1)
3-5: Trigger configuration looks good!The workflow correctly triggers on the
pull_requestopenedevent as intended.
| jobs: | ||
| notify: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Send Telegram message | ||
| uses: appleboy/telegram-action@v1.0.1 | ||
| with: | ||
| token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | ||
| to: ${{ secrets.TELEGRAM_CHAT_ID }} |
There was a problem hiding this comment.
Pin action to commit SHA for immutability.
The workflow uses appleboy/telegram-action@v1.0.1. Pinning an action to a full-length commit SHA is currently the only way to use an action as an immutable release. Consider updating to pin by SHA instead of the version tag to protect against potential tag tampering.
Additionally, add explicit read-only permissions:
jobs:
notify:
runs-on: ubuntu-latest
+ permissions:
+ pull-requests: read
steps:📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| jobs: | |
| notify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Telegram message | |
| uses: appleboy/telegram-action@v1.0.1 | |
| with: | |
| token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| to: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| jobs: | |
| notify: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| - name: Send Telegram message | |
| uses: appleboy/telegram-action@v1.0.1 | |
| with: | |
| token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| to: ${{ secrets.TELEGRAM_CHAT_ID }} |
🤖 Prompt for AI Agents
.github/workflows/telegram-pr-opened.yml lines 7-15: pin the third-party action
to a full commit SHA instead of the tag and add explicit minimal read-only
permissions; replace uses: appleboy/telegram-action@v1.0.1 with the action
reference that includes the full commit SHA (retrieve the commit SHA from the
appleboy/telegram-action repo and paste the full 40-char SHA), and add a
top-level permissions block with only the required read permissions (e.g.,
permissions: contents: read) to minimize access.
feat(ci): notify Telegram when a pull request is opened
Telegram notifications for Pull Requests
What was done
How it works
pull_request: openedevent, GitHub Actions triggers a workflow.Why
This improves team visibility and communication by instantly notifying the team about new Pull Requests without needing to check GitHub manually.
How to test
Notes
TELEGRAM_BOT_TOKENandTELEGRAM_CHAT_IDare configured at the repository level.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.