Files
dots-hyprland/.github/workflows/dist-update-notification.yml
T
2025-10-10 00:35:22 +08:00

47 lines
1.5 KiB
YAML

name: Comment on Discussion When dist-arch/ Changes
on:
push:
paths:
- 'dist-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/reference/mutations#adddiscussioncomment
run: |
MESSAGE="**Auto notification:**\n"
MESSAGE="Directory \`dist-arch\` has been updated.\n"
MESSAGE+="Commit HASH: ${{ github.sha }}\n"
MESSAGE+="Commit message: ${{ github.event.head_commit.message }}\n"
REPO="${{ github.repository }}"
REPO_OWNER="${{ github.repository_owner }}"
REPO_NAME="${REPO#$REPO_OWNER/}"
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
}
}
}
'