Refactor image handling and remove Unpic #177
Workflow file for this run
This file contains 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: First time PR merged Check | |
on: | |
pull_request: | |
types: [closed] | |
permissions: | |
pull-requests: write | |
actions: write | |
issues: write | |
jobs: | |
welcome: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 | |
with: | |
script: | | |
if (context.payload.pull_request.merged) { | |
const creator = context.payload.pull_request.user.login | |
const owner = context.repo.owner | |
const repo = context.repo.repo | |
const res = await github.rest.search.issuesAndPullRequests({ | |
q: `is:pr is:closed author:${creator} repo:${owner}/${repo}` | |
}) | |
const mergedPRs = res.data.items.filter(pr => pr.number !== context.payload.pull_request.number) | |
if (mergedPRs.length === 0) { | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `**Welcome** @${creator}, to the Contributor Squad! 🎉\n\nIf you haven't already, please join our [Discord community](https://chat.studiocms.xyz), to stay in the loop for any future help we may need!` | |
}) | |
await fetch(`${{ secrets.DISCORD_FTPR }}`, { | |
method: 'POST', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ | |
content: "<@&1223013363492192377>", | |
tts: false, | |
embeds: [ | |
{ | |
"id": 661098315, | |
"description": `New Contributor - ${creator} has had their first PR merged! 🎉\nMerged PR: [PR# ${context.issue.number}](https://github.com/astrolicious/studiocms/pull/${context.issue.number})`, | |
"fields": [], | |
"author": { | |
"name": "StudioCMS Contributor Alert", | |
"icon_url": "https://github.com/astrolicious/studiocms/blob/main/www/assets/logo-discord.png?raw=true" | |
}, | |
"title": "🚨 FIRST TIME CONTRIBUTOR 🚨" | |
} | |
], | |
components: [], | |
actions: {} | |
}) | |
}) | |
} | |
} |