[Feature]: Bundled email feature #21
This file contains hidden or 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
| name: On Pull Request Merge | |
| on: | |
| pull_request_target: | |
| types: [closed] | |
| jobs: | |
| on-merge: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.pull_request.merged == true }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Get Pull Request Data | |
| id: get-pr-data | |
| run: | | |
| echo "owner=${{ github.event.pull_request.user.login }}" >> $GITHUB_OUTPUT | |
| echo "labels=${{ join(github.event.pull_request.labels.*.name, ', ') }}" >> $GITHUB_OUTPUT | |
| echo "repo_name=${{ github.event.repository.name }}" >> $GITHUB_OUTPUT | |
| echo "repo_url=${{ github.event.repository.html_url }}" >> $GITHUB_OUTPUT | |
| - name: Send Data to API | |
| env: | |
| API_URL: https://opcode.gymkhana.iiitbh.ac.in/api/prmerged | |
| API_AUTH_TOKEN: ${{ secrets.API_AUTH_TOKEN }} | |
| OWNER: ${{ steps.get-pr-data.outputs.owner }} | |
| LABELS: ${{ steps.get-pr-data.outputs.labels }} | |
| REPO_NAME: ${{ steps.get-pr-data.outputs.repo_name }} | |
| REPO_URL: ${{ steps.get-pr-data.outputs.repo_url }} | |
| run: | | |
| payload=$(jq -n \ | |
| --arg owner "$OWNER" \ | |
| --arg labels "$LABELS" \ | |
| --arg repo_name "$REPO_NAME" \ | |
| --arg repo_url "$REPO_URL" \ | |
| '{owner: $owner, labels: $labels, repository_name: $repo_name, repository_url: $repo_url}') | |
| curl -X POST \ | |
| -H "Content-Type: application/json" \ | |
| -H "Authorization: Bearer $API_AUTH_TOKEN" \ | |
| -d "$payload" \ | |
| "$API_URL" |