From f9c30be093e7d6cf96cf92a671eaaf944a0b087d Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Tue, 24 Feb 2026 23:41:29 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20GitHub=20Discussions=E3=83=BBDiscord?= =?UTF-8?q?=E3=83=BBX=20=E3=81=B8=E3=81=AE=E4=B8=80=E6=96=89=E3=82=A2?= =?UTF-8?q?=E3=83=8A=E3=82=A6=E3=83=B3=E3=82=B9=20workflow=20=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/announce.yml | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/announce.yml diff --git a/.github/workflows/announce.yml b/.github/workflows/announce.yml new file mode 100644 index 0000000..cdebc2b --- /dev/null +++ b/.github/workflows/announce.yml @@ -0,0 +1,69 @@ +name: Announce + +on: + workflow_dispatch: + inputs: + title: + description: "タイトル" + required: true + type: string + body: + description: "本文(Markdown可、X向けには自動でプレーンテキスト化)" + required: true + type: string + channels: + description: "投稿先" + required: true + type: choice + default: "all" + options: + - all + - discussions + - discord + - twitter + +jobs: + discussions: + if: inputs.channels == 'all' || inputs.channels == 'discussions' + runs-on: ubuntu-latest + permissions: + discussions: write + steps: + - name: Post to GitHub Discussions + uses: abirber/github-create-discussion@v6 + with: + title: ${{ inputs.title }} + body: ${{ inputs.body }} + repository-id: ${{ github.event.repository.node_id }} + category-name: "Announcements" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + discord: + if: inputs.channels == 'all' || inputs.channels == 'discord' + runs-on: ubuntu-latest + steps: + - name: Post to Discord + env: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + TITLE: ${{ inputs.title }} + BODY: ${{ inputs.body }} + run: | + jq -n \ + --arg title "$TITLE" \ + --arg desc "$BODY" \ + '{embeds: [{title: $title, description: $desc, color: 5814783}]}' \ + | curl -sf -X POST -H "Content-Type: application/json" -d @- "$DISCORD_WEBHOOK_URL" + + twitter: + if: inputs.channels == 'all' || inputs.channels == 'twitter' + runs-on: ubuntu-latest + steps: + - name: Post to X + uses: ethomson/send-tweet-action@v2 + with: + status: "${{ inputs.title }}\n\n${{ inputs.body }}" + consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }} + consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }} + access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }} + access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}