-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Process Music Issues | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
permissions: | ||
issues: write | ||
contents: read | ||
|
||
jobs: | ||
process_issue: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check if issue title contains [MUSIC] | ||
run: ./scripts/check_title.sh "${{ github.event.issue.title }}" | ||
|
||
- name: Stop if not a music issue | ||
if: env.is_music_issue == 'false' | ||
run: echo "Not a music issue. Skipping further steps." | ||
|
||
- name: Check for YouTube link in issue body | ||
if: env.is_music_issue == 'true' | ||
run: ./scripts/check_youtube.sh "${{ github.event.issue.body }}" | ||
|
||
- name: Display YouTube link check result | ||
if: env.is_music_issue == 'true' | ||
run: echo "Contains YouTube link: ${{ env.has_youtube_link }}" | ||
|
||
- name: Escape issue body for JSON | ||
if: env.has_youtube_link == 'true' && env.is_music_issue == 'true' | ||
run: ./scripts/escape_issue_body.sh "${{ github.event.issue.body }}" | ||
|
||
- name: Extract and display YouTube ID if link is found | ||
if: env.has_youtube_link == 'true' && env.is_music_issue == 'true' | ||
run: ./scripts/send_payload.sh "${{ env.youtube_id }}" "${{ env.escaped_issue_body }}" | ||
|
||
- name: Post comment to issue | ||
if: env.has_youtube_link == 'true' && env.is_music_issue == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GROQ_OUTPUT: ${{ env.groq_output }} | ||
run: | | ||
COMMENT_BODY_SANITIZED=$(echo "$GROQ_OUTPUT" | sed 's/"/\\"/g') | ||
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-d "{\"body\": \"Here is the processed information:\\n\\n\`\`\`bash\\n$COMMENT_BODY_SANITIZED\\n\`\`\`\"}" \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" |