Skip to content

Commit

Permalink
feat: welcome developer for their first pr (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-crouzet authored Apr 12, 2024
2 parents 77b79c5 + 7afce15 commit bc61715
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/first-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: First PR

on:
pull_request:
types:
- opened

permissions:
contents: read
issues: read
pull-requests: write

jobs:
first-pr:
runs-on: ubuntu-latest
env:
IMAGE_URL: https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/flavors/fireworks.png
steps:
- uses: actions/github-script@v7
with:
script: |
const [owner, repo] = '${{ github.repository }}'.split('/');
github.rest.issues.listForRepo({
state: 'all',
repo: repo,
owner: owner,
creator: '${{ github.actor }}'
}).then((reply) => {
const countPR = reply.data.filter((data) => data.pull_request).length;
if (countPR === 1) {
github.rest.issues.createComment({
issue_number: context.issue.number,
repo: repo,
owner: owner,
body: '![](${{ env.IMAGE_URL }})\nThank you so much @${{ github.actor }} for opening your first PR here!'
});
} else {
console.log(`${{ github.actor }} has already opened ${countPR - 1} PRs before this one.`);
}
});
Binary file added assets/logo/flavors/fireworks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bc61715

Please sign in to comment.