Update README.md #5
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: Comment on merged PR | |
on: | |
pull_request: | |
types: [closed, labeled] | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Comment on PR | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{secrets.GH_ACTIONS}} | |
script: | | |
const fs = require('fs'); | |
const issue_number = context.issue.number; | |
const pr = await github.pulls.get(context.repo({pull_number: issue_number})); | |
const label_name = 'okayy'; | |
const has_label = pr.data.labels.some(label => label.name === label_name); | |
if (pr.data.merged && has_label) { | |
const comment_body = `This PR has been merged! Thanks @${pr.data.user.login} for your contribution!\n\n![Image]()`; | |
await github.issues.createComment(context.repo({issue_number, body: comment_body})); | |
} |