Update to Twitter #1219
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update to Twitter | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 2 * * *" # Runs at 10:00am GMT+8 (converted as 2:00am UTC) | |
| jobs: | |
| # This workflow contains a single job called "build" | |
| build: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v2 | |
| - uses: szenius/set-timezone@v1.0 | |
| with: | |
| timezoneLinux: "Asia/Kuala_Lumpur" | |
| timezoneMacos: "Asia/Kuala_Lumpur" | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "latest" | |
| architecture: "x64" | |
| - name: Update to Twitter | |
| env: | |
| TWI_APPKEY: ${{ secrets.TWI_APP_KEY }} | |
| TWI_APPSECRET: ${{ secrets.TWI_APP_SECRET }} | |
| TWI_ACCESSTOKEN: ${{ secrets.TWI_ACCESS_TOKEN }} | |
| TWI_ACCESSSECRET: ${{ secrets.TWI_ACCESS_SECRET }} | |
| run: | | |
| echo Setting variables... | |
| cd $GITHUB_WORKSPACE/nodeTwitterBot | |
| echo The following lines that appear will ensure that bash gets the environment properly. | |
| echo App key: $TWI_APPKEY | |
| echo App secret: $TWI_APPSECRET | |
| echo Access token: $TWI_ACCESSTOKEN | |
| echo Access secret: $TWI_ACCESSSECRET | |
| echo Installing Node.js required packages... | |
| npm i | |
| echo Running script... | |
| node twitter.js |