Skip to content

Post CSAT Survey Comment #111

Post CSAT Survey Comment

Post CSAT Survey Comment #111

name: Post CSAT Survey Comment
on:
discussion:
types: [answered]
permissions:
discussions: write
jobs:
post-comment:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run GraphQL Query
uses: octokit/graphql-action@v2.x
id: get_discussion
with:
query: |
query ($number: Int!) {
repository(owner: "ethereum-optimism", name: "developers") {
discussion(number: $number) {
id
title
url
answer {
author {
login
}
}
author {
login
}
}
}
}
variables: |
{
"number": ${{ github.event.discussion.number }}
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Extract data from response
run: |
ID=$(echo '${{ steps.get_discussion.outputs.data }}' | jq -r '.repository.discussion.id')
TITLE=$(echo '${{ steps.get_discussion.outputs.data }}' | jq -r '.repository.discussion.title')
AUTHOR=$(echo '${{ steps.get_discussion.outputs.data }}' | jq -r '.repository.discussion.author.login')
URL=$(echo '${{ steps.get_discussion.outputs.data }}' | jq -r '.repository.discussion.url')
ANSWER_AUTHOR=$(echo '${{ steps.get_discussion.outputs.data }}' | jq -r '.repository.discussion.answer.author.login')
echo "DISCUSSION_ID=$ID" >> $GITHUB_ENV
echo "DISCUSSION_TITLE=$TITLE" >> $GITHUB_ENV
echo "AUTHOR=$AUTHOR" >> $GITHUB_ENV
echo "DISCUSSION_URL=$URL" >> $GITHUB_ENV
echo "ANSWER_AUTHOR=$ANSWER_AUTHOR" >> $GITHUB_ENV
- name: Comment on Discussion
uses: wesleyscholl/create-discussion-comment@v1.0.18
with:
token: ${{ secrets.GITHUB_TOKEN }}
discussion-id: ${{ env.DISCUSSION_ID }}
body: "Hey @${{ env.AUTHOR }}, We hope your recent question was resolved to your satisfaction. Your feedback is invaluable and helps us improve our support services. Could you spare a moment to fill out a [short feedback survey](https://airtable.com/appQ2S9IatldkoNQw/shr84nfJi4vIlYiH2?prefill_discussion-number=${{ github.event.discussion.number }}&hide_discussion-number=true&prefill_answered-by=${{ env.ANSWER_AUTHOR }}&hide_answered-by=true). Thank you for helping us improve our developer community."