Skip to content

Update comic_easter_egg.py #133

Update comic_easter_egg.py

Update comic_easter_egg.py #133

Workflow file for this run

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