Grocery Sales Analysis (Hacktoberfest'23) #3
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: PR Closure | |
on: | |
pull_request: | |
types: | |
- closed | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check if PR is merged | |
id: check_merged | |
run: echo "::set-output name=is_merged::$(if [ \"${{ github.event.pull_request.merged }}\" == "true" ]; then echo "true"; else echo "false"; fi)" | |
- name: Comment on PR | |
uses: actions/github-script@v4 | |
with: | |
github-token: ${{ secrets.DEMO_TOKEN }} | |
script: | | |
if [ "${{ steps.check_merged.outputs.is_merged }}" == "true" ]; then | |
comment_body='Thank you, @${{ github.actor }}! Your pull request has been merged.' | |
else | |
comment_body='Thanks, @${{ github.actor }}! Unfortunately, your pull request was closed without being merged. If you have any questions or need further assistance, feel free to ask.' | |
fi | |
github.issues.createComment({ | |
issue_number: github.event.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment_body | |
}) |