From 48e32db7f04a62e24b46636567122bb47f8e2518 Mon Sep 17 00:00:00 2001 From: Freeman Liu Date: Fri, 6 Dec 2024 13:13:21 +0800 Subject: [PATCH] Use xcli create tweet --- .github/workflows/create-post-on-x.yml | 43 +++++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/create-post-on-x.yml b/.github/workflows/create-post-on-x.yml index 0493cf2..84f490d 100644 --- a/.github/workflows/create-post-on-x.yml +++ b/.github/workflows/create-post-on-x.yml @@ -1,4 +1,4 @@ -name: Create Post on X +name: Create Tweet on X on: push: @@ -12,19 +12,32 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 1 - - name: Setup Node - uses: actions/setup-node@v4 +# - name: Setup Node +# uses: actions/setup-node@v4 +# with: +# node-version: 22 +# cache: yarn +# cache-dependency-path: ./tools/post-on-x/yarn.lock +# - name: Create post on X +# working-directory: ./tools/post-on-x +# env: +# X_CONSUMER_API_KEY: ${{ secrets.X_CONSUMER_API_KEY }} +# X_CONSUMER_API_SECRET_KEY: ${{ secrets.X_CONSUMER_API_SECRET_KEY }} +# X_ACCESS_TOKEN: ${{ secrets.X_ACCESS_TOKEN }} +# X_ACCESS_TOKEN_SECRET: ${{ secrets.X_ACCESS_TOKEN_SECRET }} +# run: | +# yarn install +# yarn start + - uses: actions/setup-go@v5 with: - node-version: 22 - cache: yarn - cache-dependency-path: ./tools/post-on-x/yarn.lock - - name: Create post on X - working-directory: ./tools/post-on-x - env: - X_CONSUMER_API_KEY: ${{ secrets.X_CONSUMER_API_KEY }} - X_CONSUMER_API_SECRET_KEY: ${{ secrets.X_CONSUMER_API_SECRET_KEY }} - X_ACCESS_TOKEN: ${{ secrets.X_ACCESS_TOKEN }} - X_ACCESS_TOKEN_SECRET: ${{ secrets.X_ACCESS_TOKEN_SECRET }} + go-version: stable + - name: Create Tweet on X run: | - yarn install - yarn start + go install github.com/DanielLiu1123/xcli/cmd/xcli@latest + + COMMIT_MESSAGE="${{ github.event.head_commit.message }}" + xcli tweet create --text="${COMMIT_MESSAGE}" \ + --api-key="${X_CONSUMER_API_KEY}" \ + --api-secret="${X_CONSUMER_API_SECRET_KEY}" \ + --access-token="${X_ACCESS_TOKEN}" \ + --access-secret="${X_ACCESS_TOKEN_SECRET}"