Skip to content

Commit

Permalink
add get desc
Browse files Browse the repository at this point in the history
  • Loading branch information
crane-hiromu committed Sep 28, 2024
1 parent db3b889 commit 5a964e2
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions .github/workflows/create_x_post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,28 @@ jobs:
# 結果をGitHub Actionsの出力として設定
echo "Latest file name without extension: $LATEST_FILENAME_NO_EXT"
echo "latest_file_name=${LATEST_FILENAME}" >> $GITHUB_ENV
- name: Install dependencies
run: |
pip install tweepy
- name: Post article
env:
X_API_KEY: ${{ secrets.X_API_KEY }}
X_API_KEY_SECRET: ${{ secrets.X_API_KEY_SECRET }}
X_BEARER_TOKEN: ${{ secrets.X_BEARER_TOKEN }}
X_ACCESS_TOKEN: ${{ secrets.X_ACCESS_TOKEN }}
X_ACCESS_TOKEN_SECRET: ${{ secrets.X_ACCESS_TOKEN_SECRET }}
X_POST_MESSAGE: "この投稿は自動化をテストしている投稿です!\n\niOS関連ニュースの第${{ env.latest_file_number }}回をお届けします🍣\n\nhttps://ios-osushi.github.io/posts/${{ env.latest_file_name }}/ \n#ios_osushi"
run: python tweet.py
echo "latest_file_name=${LATEST_FILENAME_NO_EXT}" >> $GITHUB_ENV
# 最新のファイルの内容を読み込む
FILE_CONTENT=$(cat "$LATEST_FILENAME")
# descriptionの内容を抽出
DESCRIPTION=$(echo "$FILE_CONTENT" | awk '/^description:/ {print substr($0, index($0, $2))}')
echo "description=${DESCRIPTION}" >> $GITHUB_ENV # 環境変数に設定
echo "::set-output name=latest_filename::$LATEST_FILENAME"
echo "::set-output name=description::$DESCRIPTION"
# - name: Install dependencies
# run: |
# pip install tweepy

# - name: Post article
# env:
# X_API_KEY: ${{ secrets.X_API_KEY }}
# X_API_KEY_SECRET: ${{ secrets.X_API_KEY_SECRET }}
# X_BEARER_TOKEN: ${{ secrets.X_BEARER_TOKEN }}
# X_ACCESS_TOKEN: ${{ secrets.X_ACCESS_TOKEN }}
# X_ACCESS_TOKEN_SECRET: ${{ secrets.X_ACCESS_TOKEN_SECRET }}
# X_POST_MESSAGE: "この投稿は自動化をテストしている投稿です!\n\niOS関連ニュースの第${{ env.latest_file_number }}回をお届けします🍣\n\nhttps://ios-osushi.github.io/posts/${{ env.latest_file_name }}/ \n#ios_osushi"
# run: python tweet.py

0 comments on commit 5a964e2

Please sign in to comment.