Skip to content

Commit

Permalink
Merge pull request #1623 from elementary-data/close_pylon_issue3
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
oravi authored Jul 5, 2024
2 parents 68cf7aa + 4270262 commit abb7278
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 43 deletions.
File renamed without changes.
1 change: 0 additions & 1 deletion .github/workflows/create_pylon_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ jobs:
-H "Content-Type: application/json" \
-d "$json_body" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}"
83 changes: 41 additions & 42 deletions .github/workflows/update_pylon_issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,44 @@ jobs:
handle_comment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Extract Issue or Pull Request Details
id: extract_details
run: |
echo "Comment Body: ${{ github.event.comment.body }}"
if [[ "${{ github.event.issue.pull_request }}" != "" ]]; then
echo "This is a pull request comment."
# Extract ticket ID from pull request body
PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" | jq -r '.body')
pylon_ticket_id=$(echo "$PR_BODY" | grep -oP '(?<=<!-- pylon-ticket-id: )\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b(?= -->)')
echo "Extracted Ticket ID: $pylon_ticket_id"
curl --request PATCH \
--url "https://api.usepylon.com/issues/$pylon_ticket_id" \
--header "Authorization: ${{ secrets.PYLON_API_KEY }}" \
--header 'Content-Type: application/json' \
--data '{
"state": "waiting_on_you"
}'
else
echo "This is an issue comment."
# Extract ticket ID from issue body
ISSUE_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" | jq -r '.body')
echo $ISSUE_BODY
pylon_ticket_id=$(echo "$ISSUE_BODY" | grep -oP '(?<=<!-- pylon-ticket-id: )\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b(?= -->)')
echo $pylon_ticket_id
curl --request PATCH \
--url "https://api.usepylon.com/issues/$pylon_ticket_id" \
--header "Authorization: ${{ secrets.PYLON_API_KEY }}" \
--header 'Content-Type: application/json' \
--data '{
"state": "waiting_on_you"
}'
fi
- name: Checkout code
uses: actions/checkout@v2

- name: Extract Issue or Pull Request Details
id: extract_details
run: |
echo "Comment Body: ${{ github.event.comment.body }}"
if [[ "${{ github.event.issue.pull_request }}" != "" ]]; then
echo "This is a pull request comment."
# Extract ticket ID from pull request body
PR_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" | jq -r '.body')
pylon_ticket_id=$(echo "$PR_BODY" | grep -oP '(?<=<!-- pylon-ticket-id: )\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b(?= -->)')
echo "Extracted Ticket ID: $pylon_ticket_id"
curl --request PATCH \
--url "https://api.usepylon.com/issues/$pylon_ticket_id" \
--header "Authorization: ${{ secrets.PYLON_API_KEY }}" \
--header 'Content-Type: application/json' \
--data '{
"state": "waiting_on_you"
}'
else
echo "This is an issue comment."
# Extract ticket ID from issue body
ISSUE_BODY=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" | jq -r '.body')
echo $ISSUE_BODY
pylon_ticket_id=$(echo "$ISSUE_BODY" | grep -oP '(?<=<!-- pylon-ticket-id: )\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b(?= -->)')
echo $pylon_ticket_id
curl --request PATCH \
--url "https://api.usepylon.com/issues/$pylon_ticket_id" \
--header "Authorization: ${{ secrets.PYLON_API_KEY }}" \
--header 'Content-Type: application/json' \
--data '{
"state": "waiting_on_you"
}'
fi

0 comments on commit abb7278

Please sign in to comment.