Skip to content

Twitter Token

Twitter Token #26

Workflow file for this run

name: Twitter Token
on:
workflow_dispatch:
branches:
- main
# schedule:
# # GitHub Actions at 00:00 on Monday
# - cron: 0 0 * * Mon
permissions:
contents: read
jobs:
account:
name: Get Account
runs-on: ubuntu-latest
environment: ci test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Run sh and generate account
id: generate
run: |
echo "account=$(./scripts/twitter-token/generate.sh ${{ secrets.TWITTER_NAME }} ${{ secrets.TWITTER_PASSWORD }})" >> $GITHUB_OUTPUT
- name: Update TWITTER_OAUTH_TOKEN
if: ${{ steps.generate.outputs.account }}
run: |
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.MY_GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repositories/${{ github.repository_id }}/environments/ci%20test/variables/VITE_TWITTER_OAUTH_TOKEN \
-d '{"name":"VITE_TWITTER_OAUTH_TOKEN","value":"${{ fromJSON(steps.generate.outputs.account).oauth_token }}"}'
- name: Update TWITTER_OAUTH_TOKEN_SECRET
if: ${{ steps.generate.outputs.account }}
run: |
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.MY_GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repositories/${{ github.repository_id }}/environments/ci%20test/variables/VITE_TWITTER_OAUTH_TOKEN_SECRET \
-d '{"name":"VITE_TWITTER_OAUTH_TOKEN_SECRET","value":"${{ fromJSON(steps.generate.outputs.account).oauth_token_secret }}"}'