Remove extra command that is apparently not needed #101
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 | |
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) { | |
try { | |
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! 🎉 | |
If you havent already, please join our Discord, https://chat.astrolicious.dev community to stay in the loop for any future help we may need!` | |
}) | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
workflow_id: 'send-ftpr-welcome.yml', | |
ref: 'main', | |
inputs: { | |
creator: creator, | |
mergedPR: context.payload.pull_request.number.toString() | |
} | |
}) | |
} catch (error) { | |
if (error.code !== 404) { | |
throw error | |
} | |
} | |
} | |
} |