Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 Fixed Auto comment workflow issues #29

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading