mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
name: Comment on Discussion When sdist/arch/ Changes
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'sdist/arch/**'
|
|
# workflow_dispatch:
|
|
|
|
jobs:
|
|
comment_on_discussion:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create comment on discussion #2140
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DISCUSSION_NUMBER: 2140
|
|
# https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions
|
|
# https://docs.github.com/en/graphql/reference/mutations#adddiscussioncomment
|
|
run: |
|
|
MESSAGE="**Auto notification:**\n"
|
|
MESSAGE+="Directory \`sdist/arch\` has been updated.\n"
|
|
MESSAGE+="Commit HASH: ${{ github.sha }}\n"
|
|
MESSAGE+="Commit message: ${{ github.event.head_commit.message }}"
|
|
REPO_OWNER="${{ github.repository_owner }}"
|
|
REPO_NAME="${{ github.event.repository.name }}"
|
|
|
|
DISCUSSION_NODE_ID=$(gh api graphql -f query='
|
|
query {
|
|
repository( owner: "'${REPO_OWNER}'", name: "'${REPO_NAME}'" )
|
|
{ discussion(number: '${DISCUSSION_NUMBER}') { id } }
|
|
}' | \
|
|
jq -r '.data.repository.discussion.id')
|
|
gh api graphql -f query='
|
|
mutation {
|
|
addDiscussionComment(input:{
|
|
discussionId: "'$DISCUSSION_NODE_ID'",
|
|
body: "'"$MESSAGE"'",
|
|
}) {
|
|
clientMutationId
|
|
comment {
|
|
id
|
|
body
|
|
}
|
|
}
|
|
}
|
|
'
|