From 4e04e8b11b6a1f8eb80aa89b37fd0ea4d205f662 Mon Sep 17 00:00:00 2001 From: Domen Gabrovsek Date: Mon, 26 Jan 2026 14:37:13 +0100 Subject: [PATCH 1/3] feat: add commit details on pr update --- .github/workflows/pr-updated.yml | 55 +++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-updated.yml b/.github/workflows/pr-updated.yml index c8a9e10..aa3a730 100644 --- a/.github/workflows/pr-updated.yml +++ b/.github/workflows/pr-updated.yml @@ -18,9 +18,62 @@ 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 new commits from this push + id: format-commits + uses: actions/github-script@v7 + with: + result-encoding: string + script: | + // Get the before and after SHAs from the push event + const before = context.payload.before; + const after = context.payload.after || context.payload.pull_request.head.sha; + + console.log(`Comparing commits: ${before}...${after}`); + + // Compare commits to get only the new ones from this push + const { data: comparison } = await github.rest.repos.compareCommits({ + owner: context.repo.owner, + repo: context.repo.repo, + base: before, + head: after + }); + + const newCommits = comparison.commits; + + if (newCommits.length === 0) { + return 'No new commits in this push'; + } + + 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})`; + }).join('\n'); + + const count = newCommits.length; + return `${count} new 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: "šŸ”„ Pull Request Updated\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: | + šŸ”„ Pull Request Updated + + šŸ“ 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 }} + + šŸ“¦ Recent Commits: + ${{ needs.get-commits.outputs.commits }} + + šŸ”— Link: ${{ github.event.pull_request.html_url }} From 486ca870c3b0787730cd1afd64669958bc5ff2f8 Mon Sep 17 00:00:00 2001 From: Domen Gabrovsek Date: Mon, 26 Jan 2026 14:37:44 +0100 Subject: [PATCH 2/3] update 1 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 635ee01..38cd2fa 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ GitHub Actions that I reuse in other repos to send messages regarding updates to **Option 1: Use Repository Variables (Recommended)** + Add these variables to your repository (Settings → Secrets and variables → Actions → Variables): - `TELEGRAM_API_URL` - The webhook URL for your Telegram bot API (e.g., `https://abc123.execute-api.eu-central-1.amazonaws.com/prod/webhook`) From f71ad040e7d2d99a6e8a053d0745a83a619a0855 Mon Sep 17 00:00:00 2001 From: Domen Gabrovsek Date: Mon, 26 Jan 2026 14:38:00 +0100 Subject: [PATCH 3/3] update 2 --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 38cd2fa..635ee01 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ GitHub Actions that I reuse in other repos to send messages regarding updates to **Option 1: Use Repository Variables (Recommended)** - Add these variables to your repository (Settings → Secrets and variables → Actions → Variables): - `TELEGRAM_API_URL` - The webhook URL for your Telegram bot API (e.g., `https://abc123.execute-api.eu-central-1.amazonaws.com/prod/webhook`)