···11+MIT License
22+33+Copyright (c) 2023 Bombshell
44+55+Permission is hereby granted, free of charge, to any person obtaining a copy
66+of this software and associated documentation files (the "Software"), to deal
77+in the Software without restriction, including without limitation the rights
88+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+copies of the Software, and to permit persons to whom the Software is
1010+furnished to do so, subject to the following conditions:
1111+1212+The above copyright notice and this permission notice shall be included in all
1313+copies or substantial portions of the Software.
1414+1515+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+SOFTWARE.
+30
README.md
···11+# Automation
22+33+Shared GitHub Actions for the `bombshell-dev` organization.
44+55+## mergebot
66+77+This workflow posts a celebratory message in a Discord channel of your choice for each commit. For example:
88+99+> 🥳 Merged! user-a: commit (#001)
1010+> With essential contributions from user-b and user-c! 💣
1111+1212+### Usage
1313+```yml
1414+name: mergebot
1515+1616+on:
1717+ push:
1818+ branches: [main]
1919+2020+jobs:
2121+ mergebot:
2222+ if: ${{ github.repository_owner == 'bombshell-dev' }}
2323+ uses: bombshell-dev/automation/mergebot.yml@main
2424+ secrets:
2525+ DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_MERGEBOT }}
2626+```
2727+2828+## Acknowledgements
2929+3030+This repository borrows heavily from [`withastro/automation`](https://github.com/withastro/automation), published under the MIT License—Copyright (c) 2023 Astro.
···11+name: mergebot
22+33+on:
44+ workflow_call:
55+ secrets:
66+ DISCORD_WEBHOOK:
77+ description: >
88+ URL of a Discord webhook. To create one:
99+ 1. Find the channel you want to post a message in.
1010+ 2. Right-click and select “Edit Channel”.
1111+ 3. Navigate to “Integrations” > “View Webhooks”.
1212+ 4. Click “New Webhook” and copy the URL for your newly created webhook.
1313+ required: true
1414+ inputs:
1515+ EMOJIS:
1616+ description: >
1717+ Comma-delimited set of emojis.
1818+ Each mergebot message will pick one at random for the start of the message.
1919+ default: 🎉,🥳,💣,💥,🫡,🙌,👏,🙏,🏆
2020+ type: string
2121+ required: false
2222+ COAUTHOR_TEMPLATES:
2323+ description: >
2424+ A JSON array of co-author recognition templates.
2525+ Each template should contain the `<names>` placeholder.
2626+ This will be replaced by the names of one or more co-authors for this commit.
2727+ (Ignored for commits without any co-authors.)
2828+2929+ When designing templates, bear in mind that `<names>` could be one, two, or more names.
3030+ default: >
3131+ [
3232+ "Thanks for the assist, <names>! 🙏",
3333+ "<names> coming in clutch—thank you! 🙌",
3434+ "<names> made it happen! 💪",
3535+ "We couldn't have done it without <names>! 👏",
3636+ "With essential contributions from <names>! 💣",
3737+ "Teamwork makes the dream work… right <names>?! 🏆",
3838+ "feat. <names>! 🫡"
3939+ ]
4040+ type: string
4141+ required: false
4242+4343+jobs:
4444+ post-message:
4545+ runs-on: ubuntu-latest
4646+ steps:
4747+ - name: Checkout
4848+ uses: actions/checkout@v4
4949+ with:
5050+ repository: "bombshell-dev/automation"
5151+ ref: "main"
5252+ path: "automation"
5353+5454+ - name: Setup Node
5555+ uses: actions/setup-node@v4
5656+ with:
5757+ node-version: 22
5858+5959+ - id: message
6060+ name: Format Discord message
6161+ env:
6262+ GITHUB_REPO: ${{ github.event.repository.full_name }}
6363+ COMMIT_AUTHOR: ${{ github.event.commits[0].author.name }}
6464+ COMMIT_MESSAGE: ${{ github.event.commits[0].message }}
6565+ COMMIT_ID: ${{ github.event.commits[0].id }}
6666+ EMOJIS: ${{ inputs.EMOJIS }}
6767+ COAUTHOR_TEMPLATES: ${{ inputs.COAUTHOR_TEMPLATES }}
6868+ run: node automation/scripts/mergebot.js
6969+7070+ - name: Send message on Discord
7171+ env:
7272+ DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
7373+ DISCORD_MESSAGE: "${{ steps.message.outputs.DISCORD_MESSAGE }}"
7474+ run: node automation/scripts/discord.js