-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 1.08 KB
/
contributor-card.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: PR Merge Comment
on:
pull_request:
types: [opened]
push:
jobs:
post-pr-opened-comment:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get and Format Username
run: |
formatted_username=$(echo "${{ github.event.pull_request.user.login }}" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g')
echo "FORMATTED_USERNAME=$formatted_username" >> $GITHUB_ENV
- name: Create Comment
uses: actions/github-script@v6
with:
script: |
const prUser = process.env.FORMATTED_USERNAME;
const url = `https://datahub-contributor-cards.vercel.app/${prUser}`;
const body = `![Image](downloaded_image.png)\n\n@${prUser} Thank you for opening a pull request!\nVisit your page here: [${url}](${url})`;
// Create a comment on the PR
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: body
});