Skip to content

Update various actions and package info #196

Update various actions and package info

Update various actions and package info #196

Workflow file for this run

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:
github-token: ${{ secrets.STUDIOCMS_SERVICE_TOKEN }}
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.dev), 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: `<@&${{ secrets.DISCORD_ROLE_HONOURED }}>, <@&${{ secrets.DISCORD_ROLE_REVERED }}>, <@&${{ secrets.DISCORD_ROLE_EXALTED }}>`,
tts: false,
embeds: [
{
"id": 661098315,
"description": `New StudioCMS Contributor - ${creator} has had their first PR merged! 🎉\nMerged PR: [PR# ${context.issue.number}](https://github.com/withstudiocms/studiocms/pull/${context.issue.number})`,
"fields": [],
"author": {
"name": "StudioCMS Contributor Alert",
"icon_url": "https://github.com/withstudiocms/studiocms.dev/blob/main/assets/logo-discord.png?raw=true"
},
"title": "🚨 FIRST TIME CONTRIBUTOR 🚨"
}
],
components: [],
actions: {}
})
})
}
}