Skip to content

Commit

Permalink
Merge branch 'UTSAVS26:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
aviralgarg05 authored Oct 2, 2024
2 parents 8f410f6 + cf4f385 commit 8f77abe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/Auto_message_on_pr_merge.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
name: Auto Comment on PR Merge
name: Auto Comment on Merged PR

on:
pull_request:
types: [closed]

permissions:
issues: write
pull-requests: write
types:
- closed

jobs:
comment-on-merge:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

permissions:
pull-requests: write
issues: write

steps:
- name: Add Comment to Merged PR
- name: Add comment to merged pull request
run: |
COMMENT=$(cat <<EOF
{
Expand All @@ -32,6 +33,4 @@ jobs:
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add comment on merge"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fi
6 changes: 4 additions & 2 deletions .github/workflows/auto-comment-on-issue-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:

steps:
- name: Add Comment to Closed Issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
COMMENT=$(cat <<EOF
{
Expand All @@ -22,12 +24,12 @@ jobs:
)
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
-d "$COMMENT")
cat response.json
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add comment on issue close"
exit 1
f1
fi

0 comments on commit 8f77abe

Please sign in to comment.