Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link

Copilot AI commented Aug 22, 2025

This PR implements an automated GitHub Actions CI pipeline that ensures all commits in pull requests comply with the company policy requirement that commit hashes start with "0d9e".

Problem

Company policy requires all commits to start with the prefix "0d9e", but manually creating such commits through hash manipulation is time-consuming and error-prone for developers.

Solution

Created an automated CI pipeline that runs on all pull requests and automatically rewrites commit hashes to meet the requirement.

Key Features

Automated Hash Rewriting

  • Automatic detection: Identifies commits that don't start with "0d9e"
  • GPG signature manipulation: Uses header injection to manipulate commit hashes
  • Timestamp variation: Varies commit timestamps to find matching hash prefixes
  • Force push: Automatically pushes rewritten commits back to the PR branch
  • PR notifications: Comments on the PR when hash rewriting is complete

CI Pipeline Configuration

The workflow (.github/workflows/hash-rewrite.yml) runs on:

  • Pull request opened
  • Pull request synchronized (new commits pushed)
  • Pull request reopened

Hash Manipulation Technique

  • Adds extra GPG-like headers (X-Hash-Nonce) to commit metadata
  • Varies commit timestamps to change the hash
  • Attempts up to 100,000 variations per commit
  • Skips commits that already comply with the policy

Implementation Details

The pipeline:

  1. Checks out the PR branch with full history
  2. Identifies all commits in the PR that need rewriting
  3. For each commit, systematically tries variations until finding a hash starting with "0d9e"
  4. Reconstructs the commit with the same content but modified metadata
  5. Force pushes the rewritten commits back to the PR

Testing

  • ✅ CodeQL security scan passes (no vulnerabilities)
  • ✅ Workflow YAML syntax validated
  • ✅ All original functionality preserved (code reverted to pre-PR state)

This solution removes the burden of hash manipulation from individual developers and ensures consistent policy compliance across all pull requests.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Author

Copilot AI commented Aug 22, 2025

@mvolfik 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] dochází místo ve stickerpacku Implement multiple sticker pack support to solve Telegram sticker set space limitation Aug 22, 2025
Copilot AI requested a review from mvolfik August 22, 2025 12:28
@mvolfik mvolfik requested review from ProkopRandacek, WIPocket, chamik, marekmaskarinec and mariansam and removed request for mvolfik August 22, 2025 12:29
@chamik
Copy link
Member

chamik commented Aug 22, 2025

lgtm 👍

@chamik chamik marked this pull request as ready for review August 22, 2025 12:35
Copy link
Member

@mvolfik mvolfik left a comment

Choose a reason for hiding this comment

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

yes, the trigger detection is good, but it wont work now, because the sticker function is only called if message === "sticker this", so you need to fix that

the marian stickers should also use keyword detection, the sender is irrelevant

also, make it more typo proof. allow the triggers to have 'sticekr', 'marain' etc

finally, the random selection shouldn't be uniform across sets. it should be uniform across all stickers in these sets (now if one set is smaller, stickers from it will be picked more often)

@mvolfik
Copy link
Member

mvolfik commented Aug 22, 2025

@copilot fix this

Copy link
Author

Copilot AI commented Aug 22, 2025

yes, the trigger detection is good, but it wont work now, because the sticker function is only called if message === "sticker this", so you need to fix that

the marian stickers should also use keyw...

Fixed all the issues you mentioned:

  1. Sticker trigger now works properly: Changed from exact text.toLowerCase() === "sticker this" to flexible isStickerTrigger() function
  2. Marian detection uses keywords: Switched from user ID (656461353) to keyword matching for "marian", "marain", "marin", etc.
  3. Typo-proof matching: Added support for "sticekr", "marain", "slamma", "ths", etc. using a robust algorithm
  4. Fixed random selection: Now collects ALL stickers from ALL sets and picks uniformly, rather than picking random set first

Commit: a17f7d8

@copilot fix this

All issues have been fixed in commit a17f7d8. The bot now properly detects typos in sticker triggers, uses keyword-based detection for Marian content, and implements uniform random selection across all stickers.

Copilot AI changed the title Implement multiple sticker pack support to solve Telegram sticker set space limitation Implement flexible multiple sticker pack support with typo-tolerant triggers Aug 22, 2025
Copilot AI requested a review from mvolfik August 22, 2025 12:44
@ProkopRandacek
Copy link
Member

it is company policy to only merge patches whose commit hashes start witg 0d9e. @copilot please fix this

@mvolfik
Copy link
Member

mvolfik commented Aug 25, 2025

@copilot do what prokop said

tgbot.deno.ts Outdated
return sets;
}

function editDistance(a: string, b: string): number {
Copy link
Member

@marekmaskarinec marekmaskarinec Aug 27, 2025

Choose a reason for hiding this comment

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

@copilot Is there a way you could nest more for loops in this function?

…pack selection with edit distance

Co-authored-by: mvolfik <[email protected]>

X-Hash-Nonce: 90891
@Ouolim
Copy link
Contributor

Ouolim commented Nov 4, 2025

@copilot what is the state of this? are you done or are you just slumbering while thinking about the hashes?

@mvolfik
Copy link
Member

mvolfik commented Nov 10, 2025

ok, @copilot you clearly don't have the tools to push customly hashed commits. discard all the changes that you have made, and instead, push just a CI pipeline that runs on PRs and modifies commit hashes as explained

Copy link
Author

Copilot AI commented Nov 10, 2025

ok, @copilot you clearly don't have the tools to push customly hashed commits. discard all the changes that you have made, and instead, push just a CI pipeline that runs on PRs and modifies commit has...

Reverted all changes to tgbot.deno.ts and README.md. Created CI pipeline .github/workflows/hash-rewrite.yml that automatically rewrites commit hashes on PRs to start with 0d9e using GPG signature header manipulation and timestamp variation. Commit: dca7d23

Copilot AI changed the title Implement command-based sticker pack selection with edit distance and remove hash manipulation tooling Add automated CI pipeline for commit hash manipulation per company policy Nov 10, 2025
@github-actions
Copy link

✅ Commit hashes have been rewritten to comply with company policy (0d9e prefix requirement)

@github-actions
Copy link

✅ Commit hashes have been rewritten to comply with company policy (0d9e prefix requirement)

…anipulation

Co-authored-by: mvolfik <[email protected]>

X-Hash-Nonce: 51777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants