forked from Shinonome/dots-hyprland
40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
name: Comment on Discussion When dist-arch/ Changes
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'dist-arch/**'
|
|
- '.github/workflows/**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
comment_on_discussion:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create comment on discussion #2140
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# https://docs.github.com/en/graphql/reference/mutations#adddiscussioncomment
|
|
run: |
|
|
DISCUSSION_NODE_ID=$(gh api graphql -f query='
|
|
query {
|
|
repository( owner: "end-4", name: "dots-hyprland" )
|
|
{ discussion(number: 2140) { id } }
|
|
}' | \
|
|
jq -r '.data.repository.discussion.id')
|
|
echo "The value of DISCUSSION_NODE_ID is ${DISCUSSION_NODE_ID}."
|
|
gh api graphql -f query='
|
|
mutation {
|
|
addDiscussionComment(input:{
|
|
discussionId: "$DISCUSSION_NODE_ID",
|
|
body: "dist-arch/ directory has changed in commit ${{ github.sha }} by ${{ github.actor }}.",
|
|
}) {
|
|
clientMutationId
|
|
comment {
|
|
id
|
|
body
|
|
}
|
|
}
|
|
}
|
|
'
|