Update comic_easter_egg.py #133
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: British Banter Bot π¬π§ | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| banter_mode: | |
| description: 'Select banter style' | |
| required: true | |
| default: 'random' | |
| type: choice | |
| options: | |
| - random | |
| - british | |
| - pirate | |
| - cockney | |
| - upper-class | |
| - yorkshire | |
| - scottish | |
| - posh-london | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| jobs: | |
| banter: | |
| name: Generate Banter | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "British Banter Bot π¬π§" | |
| git config user.email "banter@example.com" | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| if git diff --quiet HEAD~1 HEAD; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Determine Banter Mode | |
| id: mode | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| SELECTED_MODE="${{ github.event.inputs.banter_mode }}" | |
| else | |
| SELECTED_MODE="random" | |
| fi | |
| if [ "$SELECTED_MODE" == "random" ]; then | |
| MODES=("british" "pirate" "cockney" "upper-class" "yorkshire" "scottish" "posh-london") | |
| SELECTED_MODE=${MODES[$((RANDOM % ${#MODES[@]}))]} | |
| fi | |
| echo "mode=$SELECTED_MODE" >> $GITHUB_OUTPUT | |
| - name: Generate British Banter | |
| id: british | |
| if: steps.mode.outputs.mode == 'british' | |
| run: | | |
| messages=( | |
| "fix: squashed that bug like a proper legend ππ οΈπ₯" | |
| "feat: added a cheeky new feature, sorted innit bruv π§β¨π" | |
| "chore: tidied up the config, all neat now π₯π§π§Ή" | |
| "docs: wrote it all down like a true gent πππ§" | |
| "refactor: cleaned up the mess, proper tidy π§ππ§" | |
| "style: made it look snazzy, innit π¨π§π" | |
| "test: gave it a proper poke, all green now β ππ§" | |
| "fix: patched it up like a boss π₯π οΈπ" | |
| "feat: dropped a spicy new bit of code πΆοΈππ§" | |
| "chore: decluttered the codebase, lovely jubbly π§½πβ¨" | |
| "perf: made it faster than a London underground πβ‘π" | |
| "fix: ironed out the wrinkles, looking sharp ππ§π" | |
| "feat: brilliant innovation, that is π‘π§β¨" | |
| "docs: documented it better than the Queen's English πππ" | |
| "refactor: restructured the whole thing, Bob's your uncle π―π" | |
| "test: tested it within an inch of its life β π¬π" | |
| ) | |
| RANDOM_INDEX=$((RANDOM % ${#messages[@]})) | |
| echo "commit_message=${messages[$RANDOM_INDEX]}" >> $GITHUB_OUTPUT | |
| - name: Generate Pirate Banter | |
| id: pirate | |
| if: steps.mode.outputs.mode == 'pirate' | |
| run: | | |
| messages=( | |
| "fix: arrr, slayed that bug like a fearless buccaneer π΄ββ οΈβοΈπ" | |
| "feat: shiver me timbers, added treasure of a feature π΄ββ οΈπβ¨" | |
| "chore: swab the deck, cleaned up this code proper like π§Ήβπ΄ββ οΈ" | |
| "docs: wrote it down like a captain's log, it is ππ΄ββ οΈβ" | |
| "refactor: plundered and pillaged the codebase, savvy πΊοΈπβ¨" | |
| "style: polished like a pirate's cutlass, it be shinin' π‘οΈβ¨π΄ββ οΈ" | |
| "test: tested with the wrath of Davy Jones himself βπβ " | |
| "fix: fixed it faster than ye can say 'yo ho ho' π΄ββ οΈβ‘π" | |
| "feat: dropped a booty load of new code, matey π΄ββ οΈπ°π§" | |
| "chore: cast off the barnacles, ship be fresh now π’β¨π" | |
| "perf: sped it up like a pirate ship in a hurricane πͺοΈββ‘" | |
| "fix: patched the hull breach with cannons of code π΄ββ οΈπ«π" | |
| "feat: a legendary new feature, tell all the seven seas ππ΄ββ οΈπ‘" | |
| "docs: scrolled the knowledge like an old treasure map πΊοΈππ΄ββ οΈ" | |
| "refactor: reorganized like a pirate's plundered fortress π΄ββ οΈπ―π" | |
| "test: gave it the trials of the Caribbean, it survives πβ β" | |
| ) | |
| RANDOM_INDEX=$((RANDOM % ${#messages[@]})) | |
| echo "commit_message=${messages[$RANDOM_INDEX]}" >> $GITHUB_OUTPUT | |
| - name: Generate Cockney Banter | |
| id: cockney | |
| if: steps.mode.outputs.mode == 'cockney' | |
| run: | | |
| messages=( | |
| "fix: blimey, fixed that bug innit, ain't it sweet πͺπ’β¨" | |
| "feat: cor strike a light, got a new feature for ya gal πβ¨π" | |
| "chore: tidy up the gaff, clean as a whistle now mate π§Ήβ¨π©" | |
| "docs: wrote it all down proper, like a London geezer ππ©β¨" | |
| "refactor: rearranged the crib, all spick and span bruv π―πͺπ©" | |
| "style: made it look lush, innit a beaut π¨β¨π" | |
| "test: poked it about somethin' fierce, all sorted yeah πβ πͺ" | |
| "fix: done it up like a proper cockney warrior, no sweat πβοΈβ¨" | |
| "feat: blimey, dropped some mint new bits of code πΏπβ¨" | |
| "chore: swept out the old, brought in the new, lovely π§Ήππ©" | |
| "perf: made it quicker than a London cabbie, nuff said β‘ππ" | |
| "fix: patched it up slicker than ye old codger's pipe π§β¨π©" | |
| "feat: stone the crows, this feature is the bees knees πππ" | |
| "docs: scribbled it down like old Dick Whittington ππ©β¨" | |
| "refactor: reorganized like a proper market stall arrangement π―πͺπͺ" | |
| "test: gave it a right old going over, bob's yer uncle β ππ©" | |
| ) | |
| RANDOM_INDEX=$((RANDOM % ${#messages[@]})) | |
| echo "commit_message=${messages[$RANDOM_INDEX]}" >> $GITHUB_OUTPUT | |
| - name: Generate Upper-Class Banter | |
| id: upper-class | |
| if: steps.mode.outputs.mode == 'upper-class' | |
| run: | | |
| messages=( | |
| "fix: one has quite efficiently eliminated the offending bug, what what π©πβ¨" | |
| "feat: a most splendid feature has been introduced to one's codebase, naturally ππ₯β¨" | |
| "chore: the repository has been organised with the utmost propriety, I assure you π§Ήπβ¨" | |
| "docs: documentation crafted with the precision of Oxford scholars, indeed πππ©" | |
| "refactor: the code structure has been restructured with aristocratic elegance π―πβ¨" | |
| "style: the aesthetics have been refined to the highest standards of sophistication π¨ππ" | |
| "test: one has subjected the code to rigorous examination, most thoroughly π¬β π" | |
| "fix: the malfunction has been rectified with the grace of a Mayfair gentleman π©β¨π" | |
| "feat: a magnificent contribution to the digital estate, positively splendid π‘ππ₯" | |
| "chore: the digital manor has been tidied to perfection, indubitably so π§Ήβ¨π" | |
| "perf: acceleration achieved with the finesse of a Rolls-Royce engine β‘ππ" | |
| "fix: patched with the precision of a Savile Row tailor, exceedingly fine π§πβ¨" | |
| "feat: a most distinguished innovation for the discerning programmer, I say ππ©β¨" | |
| "docs: documented with the eloquence of a Cambridge Don, supremely executed πππ©" | |
| "refactor: restructured with the deportment of Windsor Castle guardians π°ππ" | |
| "test: examined with the rigour of a Buckingham Palace inspection, absolutely flawless β ππ" | |
| ) | |
| RANDOM_INDEX=$((RANDOM % ${#messages[@]})) | |
| echo "commit_message=${messages[$RANDOM_INDEX]}" >> $GITHUB_OUTPUT | |
| - name: Generate Yorkshire Banter | |
| id: yorkshire | |
| if: steps.mode.outputs.mode == 'yorkshire' | |
| run: | | |
| messages=( | |
| "fix: right then, fixed that bug like a proper Yorkshire warrior π οΈπͺβͺ" | |
| "feat: nay bother, added a grand feature, none of yer nonsense π‘β¨βͺ" | |
| "chore: sorted the codebase, clean as a new cloth on t'loom π§Ήβͺβ¨" | |
| "docs: wrote it all down proper, like a true Yorkshire scribe πβͺπͺ" | |
| "refactor: reorganized t'whole thing, neat and tidy like π―βͺπͺ" | |
| "style: made it look right grand, that code does π¨β¨βͺ" | |
| "test: poked at it till it squealed, all working now πβ βͺ" | |
| "fix: fixed it faster than you can say 'eh bab' πβ‘βͺ" | |
| "feat: by 'eck, added some cracking new code, proper champion πβ¨βͺ" | |
| "chore: cleaned up t'mess, neat and proper like π§Ήπͺβͺ" | |
| "perf: sped up faster than a Yorkshire pudding in t'oven β‘π²βͺ" | |
| "fix: patched it up like a proper Yorkshire tradesman π§βͺπͺ" | |
| "feat: this feature's a real belter, I tell thee πβ¨βͺ" | |
| "docs: documented it better than t'Leeds Library, I reckon πβͺπͺ" | |
| "refactor: restructured like a Yorkshire stone wall, solid as owt βοΈβͺπͺ" | |
| "test: tested it within an inch of its life, Yorkshire style β βͺπͺ" | |
| ) | |
| RANDOM_INDEX=$((RANDOM % ${#messages[@]})) | |
| echo "commit_message=${messages[$RANDOM_INDEX]}" >> $GITHUB_OUTPUT | |
| - name: Generate Scottish Banter | |
| id: scottish | |
| if: steps.mode.outputs.mode == 'scottish' | |
| run: | | |
| messages=( | |
| "fix: och aye, bashed that bug like a true Scot π₯βοΈπΊ" | |
| "feat: bonnie wee feature, aye ye dinnae get better than this π‘β¨π°" | |
| "chore: tidied up the codebase, clean as a highland loch π§Ήβ¨ποΈ" | |
| "docs: wrote it doon like a true son o' Scotland ππ°βοΈ" | |
| "refactor: reorganized tae perfection, as they dae in Edinburgh π―β¨π°" | |
| "style: made it bonnie tae look upon, a true Caledonian marvel π¨π°β¨" | |
| "test: tested it tougher than Highland heather, all sorted πβ ποΈ" | |
| "fix: fixed faster than a Speyside distillery works its magic β‘π₯β¨" | |
| "feat: a bonnie new feature, aye the best in a' the land ππ°π₯" | |
| "chore: swept oot the auld, brought in the new, braw π§Ήπ°β¨" | |
| "perf: sped up like Loch Ness waters in flood, I tell ye πβ‘ποΈ" | |
| "fix: patched it like a true Scottish craftsman, nae messin' π§π°πͺ" | |
| "feat: this feature's a bonnie doozy, straight frae the Highlands ποΈπ‘π₯" | |
| "docs: documented it better than Robert Burns himself πβοΈπ°" | |
| "refactor: reorganized like a proper Scottish fortification, solid π°π―πͺ" | |
| "test: tested it tae the limits, och ye beauty π¬β π₯" | |
| ) | |
| RANDOM_INDEX=$((RANDOM % ${#messages[@]})) | |
| echo "commit_message=${messages[$RANDOM_INDEX]}" >> $GITHUB_OUTPUT | |
| - name: Generate Posh London Banter | |
| id: posh-london | |
| if: steps.mode.outputs.mode == 'posh-london' | |
| run: | | |
| messages=( | |
| "fix: frightfully good show, vanquished that pesky bug from Chelsea π©πβ¨" | |
| "feat: darling, we've procured a most delightful feature for SW1A 1AA" | |
| "chore: the codebase has been organised with the panache of Belgravia finest π§Ήπβ¨" | |
| "docs: documented with the eloquence of a Knightsbridge scholar, naturally πππ©" | |
| "refactor: restructured with the finesse of a Kensington townhouse restoration ποΈβ¨π" | |
| "style: polished to the lustrous gleam of polished Knightsbridge marble π¨πβ¨" | |
| "test: subjected to the rigorous standards of a Mayfair investment review β ππ" | |
| "fix: rectified with the precision of a Bespoke Savile Row tailor π§π©β¨" | |
| "feat: an absolutely divine contribution, worthy of The Ritz itself π‘ππ₯" | |
| "chore: organised with the meticulousness of a Claridge's concierge π§Ήβ¨π" | |
| "perf: accelerated with the smoothness of a Bentley on Park Lane β‘ππ" | |
| "fix: patched with the elegance of a Harrods fine restoration service π§πβ¨" | |
| "feat: a positively exquisite innovation, strictly for the discerning coder ππβ¨" | |
| "docs: composed with the sophistication of a Claridge's invitation, I must say ππ©π" | |
| "refactor: restructured with the architectual grandeur of Westminster Abbey π°ππ" | |
| "test: examined with the meticulous care of a Sotheby's appraisal, absolutely impeccable β ππ" | |
| ) | |
| RANDOM_INDEX=$((RANDOM % ${#messages[@]})) | |
| echo "commit_message=${messages[$RANDOM_INDEX]}" >> $GITHUB_OUTPUT | |
| - name: Consolidate Message | |
| id: message | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| MODE="${{ steps.mode.outputs.mode }}" | |
| case $MODE in | |
| pirate) | |
| COMMIT_MSG="${{ steps.pirate.outputs.commit_message }}" | |
| ;; | |
| cockney) | |
| COMMIT_MSG="${{ steps.cockney.outputs.commit_message }}" | |
| ;; | |
| upper-class) | |
| COMMIT_MSG="${{ steps.upper-class.outputs.commit_message }}" | |
| ;; | |
| yorkshire) | |
| COMMIT_MSG="${{ steps.yorkshire.outputs.commit_message }}" | |
| ;; | |
| scottish) | |
| COMMIT_MSG="${{ steps.scottish.outputs.commit_message }}" | |
| ;; | |
| posh-london) | |
| COMMIT_MSG="${{ steps.posh-london.outputs.commit_message }}" | |
| ;; | |
| *) | |
| COMMIT_MSG="${{ steps.british.outputs.commit_message }}" | |
| ;; | |
| esac | |
| echo "commit_message=$COMMIT_MSG" >> $GITHUB_OUTPUT | |
| - name: Amend last commit with banter | |
| if: steps.changes.outputs.has_changes == 'true' | |
| env: | |
| COMMIT_MSG: ${{ steps.message.outputs.commit_message }} | |
| run: | | |
| git commit --amend -m "$COMMIT_MSG" --no-edit 2>/dev/null || echo "βΉοΈ No changes to amend" | |
| git push --force-with-lease origin main 2>/dev/null || echo "βΉοΈ Nothing to push" | |
| - name: Post Comment | |
| if: steps.changes.outputs.has_changes == 'true' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| MODE="${{ steps.mode.outputs.mode }}" | |
| COMMIT_SHA=$(git rev-parse HEAD) | |
| case $MODE in | |
| pirate) | |
| REACTIONS=("Shiver me timbers! Commit \`$COMMIT_SHA\` be fit for the high seas π΄ββ οΈπ" "Arrr, ye be a true buccaneer! That commit be legendary π΄ββ οΈβοΈ" "Yo ho ho! Commit \`$COMMIT_SHA\` be worth its weight in doubloons π΄ββ οΈπ°" "Blimey, ye've plundered a fine piece of code there, matey! π΄ββ οΈβ¨" "Dead men tell no tales, but this commit \`$COMMIT_SHA\` speaks volumes! π΄ββ οΈπ" "Avast ye! That be the finest work ever to sail these digital seas π΄ββ οΈπ") | |
| ;; | |
| cockney) | |
| REACTIONS=("Blimey! Commit \`$COMMIT_SHA\` is the dog's dinner, innit! πβ¨" "Stone the crows, that's a belter mate! Proper lush work ππ" "Cor strike a light! Ye did good there gal, real good ππͺ" "Blimey, I ain't never seen code so clean, lovely jubbly! π§Ήβ¨" "Stone my crows, commit \`$COMMIT_SHA\` is mint innit, top drawer! ππ©" "Aw nah fam, that code be fresher than a Billingsgate catch! πβ¨") | |
| ;; | |
| upper-class) | |
| REACTIONS=("Most extraordinary! Commit \`$COMMIT_SHA\` exemplifies the pinnacle of elegance ππ" "One must congratulate you forthwithβthis is positively Shakespearean coding! ππ" "Absolutely smashing! A commit of such refinement rarely graces our repositories πβ¨" "Pip pip! Commit \`$COMMIT_SHA\` is fit for Her Majesty's personal collection ππ°" "Indubitably magnificent! The workmanship here is simply beyond reproach π©π" "What ho! This code exhibits the sophistication of a well-tailored waistcoat indeed! πβ¨") | |
| ;; | |
| yorkshire) | |
| REACTIONS=("By 'eck, that's a cracking commit there, mate! πͺβͺ" "Right then, commit \`$COMMIT_SHA\` is nay bother, proper champion stuff πβͺ" "Eh up, that code's grand as owt! Braw work, duck π‘β¨" "Stone the crows, that commit's a real belter innit! π―βͺ" "Nay nonsense, that's quality work, proper Yorkshire pride πͺβͺ" "By gum, ye've done summat special there, real proper like! β¨βͺ") | |
| ;; | |
| scottish) | |
| REACTIONS=("Och aye, that commit's bonnie as a Highland morning! π°π" "By the waters o' Loch Ness! Commit \`$COMMIT_SHA\` is absolutely braw! πβ¨" "Aye, that's the finest work I've seen oot o' the Lowlands! π°π₯" "Och, ye're a true son o' Scotland with that code! πͺποΈ" "Blimey, that commit's worth a dram o' the finest whisky! π₯β¨" "Haud yer wheesht, that's pure dead brilliant, mate! π―βοΈ") | |
| ;; | |
| posh-london) | |
| REACTIONS=("Absolutely divine! Commit \`$COMMIT_SHA\` is fit for The Ritz itself, darling ππ" "Frightfully good show! One's impressed with such Knightsbridge-calibre work ποΈπ" "Pip pip! That commit would grace any Mayfair establishment, truly exquisite π©β¨" "Positively smashing! Commit \`$COMMIT_SHA\` is the epitome of Chelsea elegance ππ" "I say, what a splendid piece of work from a Belgravia perspective! πβ¨" "Absolutely posh! This commit's worthy of a Claridge's celebration, old sport π₯π") | |
| ;; | |
| *) | |
| REACTIONS=("Nice one, bruv! β commit \`$COMMIT_SHA\` is looking mint ππ§" "Cor blimey! That's a belter of a commit, that is ππ" "Sorted! Commit \`$COMMIT_SHA\` is absolutely pukka πβ¨" "Blimey, you've done well there! Absolute cracker πͺπ" "Top marks! Commit \`$COMMIT_SHA\` is the bee's knees ππ" "Brilliant work, mate! That's a gem of a commit ππ§") | |
| ;; | |
| esac | |
| RANDOM_INDEX=$((RANDOM % ${#REACTIONS[@]})) | |
| COMMENT="${REACTIONS[$RANDOM_INDEX]}" | |
| curl -s -X POST -H "Authorization: token $GH_TOKEN" -H "Content-Type: application/json" \ | |
| -d "{\"body\": \"$COMMENT\"}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/commits/$COMMIT_SHA/comments" \ | |
| || echo "β οΈ Comment failed" | |
| - name: Post workflow summary | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| MODE="${{ steps.mode.outputs.mode }}" | |
| echo "β British Banter Applied Successfully! π¬π§" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "π **Banter Mode:** \`${MODE^^}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "π **Commit Message:**" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| echo "${{ steps.message.outputs.commit_message }}" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "πͺ The madness continues!" >> $GITHUB_STEP_SUMMARY |