Skip to content

Adding a edit quote

Adding a edit quote #4

Workflow file for this run

name: Congratulatory Message
on:
issues:
types: [opened]
push:
branches: [main] # Change this to your default branch
pull_request:
types: [opened, closed]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Send Congratulatory Message
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
run: |
echo "Congratulations @${{ github.event.pull_request.user.login }}! Your PR has been merged! 🎉"
# Optionally, you can call the OpenAI API to generate a unique message.
# Install curl if it's not available
sudo apt-get install curl
# Set your OpenAI API Key in the repository secrets
OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
# Call OpenAI API
RESPONSE=$(curl https://api.openai.com/v1/chat/completions \
-s \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "Generate a unique congratulatory message for a GitHub contributor."}],
"max_tokens": 50
}')
# Extract the content from the response
MESSAGE=$(echo $RESPONSE | jq -r '.choices[0].message.content')
# Print the message
echo "Message from OpenAI: $MESSAGE"