Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
45 changes: 44 additions & 1 deletion .github/workflows/pr-opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,52 @@ on:
description: 'Telegram chat ID to send notifications to'

jobs:
get-commits:
runs-on: ubuntu-latest
outputs:
commits: ${{ steps.format-commits.outputs.result }}
steps:
- name: Get commits from PR
id: format-commits
uses: actions/github-script@v7
with:
result-encoding: string
script: |
// Get commits from the PR
const { data: commits } = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});

if (commits.length === 0) {
return 'No commits in this PR';
}

const commitList = commits.map(commit => {
const message = commit.commit.message.split('\n')[0]; // First line only
const sha = commit.sha.substring(0, 7);
return `• ${sha} - ${message}`;
}).join('\n');

const count = commits.length;
return `${count} commit${count !== 1 ? 's' : ''}:\n${commitList}`;

notify:
needs: get-commits
uses: domengabrovsek/github-actions/.github/workflows/send-telegram-message.yml@master
with:
api_url: ${{ inputs.api_url }}
chat_id: ${{ inputs.chat_id }}
message: "🚀 New Pull Request Opened\n\n📝 Title: ${{ github.event.pull_request.title }}\n👤 Author: ${{ github.event.pull_request.user.login }}\n🌿 Branch: `${{ github.event.pull_request.head.ref }}` → `${{ github.event.pull_request.base.ref }}`\n🔗 Link: ${{ github.event.pull_request.html_url }}\n📊 Repository: ${{ github.repository }}"
message: |
🚀 New Pull Request Opened

📝 Title: ${{ github.event.pull_request.title }}
👤 Author: ${{ github.event.pull_request.user.login }}
🌿 Branch: `${{ github.event.pull_request.head.ref }}` → `${{ github.event.pull_request.base.ref }}`
📊 Repository: ${{ github.repository }}

📦 Commits:
${{ needs.get-commits.outputs.commits }}

🔗 Link: ${{ github.event.pull_request.html_url }}
3 changes: 1 addition & 2 deletions .github/workflows/pr-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ jobs:
const commitList = newCommits.map(commit => {
const message = commit.commit.message.split('\n')[0]; // First line only
const sha = commit.sha.substring(0, 7);
const author = commit.commit.author.name;
return `• ${sha} - ${message} (${author})`;
return `• ${sha} - ${message}`;
}).join('\n');

const count = newCommits.length;
Expand Down