LoginSignup
0
0

More than 3 years have passed since last update.

[GitHub Actions] TOEIC試験までのカントダウンツイートを自動化

Last updated at Posted at 2021-03-28

はじめに

エンジニアをやっていると、さまざまな試験を受験する機会があります(情報処理試験、TOEICなどなど)。試験日までの残り日数を気軽に確認したいなと思い、GitHub ActionsとTwitter APIを利用して、作成して見ました。

1. 作成物

2. 利用方法

.github/workflows/main.yml をお好きなように、編集し利用できます。

main.yml
name: 'tweet-coutdown'
on:
  schedule:
    - cron: '30 22 * * *'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: |
          npm install && npm run build && npm run package
      - uses: ./
        with:
          consumer_key: ${{ secrets.TWITTER_API_KEY }}
          consumer_secret: ${{ secrets.TWITTER_API_SECRET_KEY }}
          access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN }}
          access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
          first_message: |
            🕑 カウントダウン
            📝 TOEIC試験 2021/02/28 まで
          target_date: '2021/02/28'
          last_message: |
            あと少し頑張りましょう🙋🏻🙋🏻‍♀️
            ※毎日 7:30 に更新(Github Actionsより)
            #TOEIC
            #カウントダウン
            #勉強

結果は以下の通り。

tweet_image.png

3. TOEICの結果

ちなみに、結果は 705点 でした。まあ700目標だからOKです。

4. Javascriptアクションのテンプレート

以下に、Javascriptのtemplateが用意されています。こちらをベースに作成しました。

5. 所感

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0