Skip to content

Commit

Permalink
[Add] post to twitter github release
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGalek committed Jan 29, 2025
1 parent dc8bdd9 commit 1c17760
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,30 @@ jobs:
with:
branch: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: pip install tweepy

- name: Send tweet
env:
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
run: |
python - <<EOF
import tweepy
import os
client = tweepy.Client(
consumer_key=os.getenv("TWITTER_CONSUMER_API_KEY"),
consumer_secret=os.getenv("TWITTER_CONSUMER_API_SECRET"),
access_token=os.getenv("TWITTER_ACCESS_TOKEN"),
access_token_secret=os.getenv("TWITTER_ACCESS_TOKEN_SECRET")
)
tweet_text = f"🚀 New version of {os.getenv('GITHUB_REF_NAME')} just released! 🎉\n\n{os.getenv('GITHUB_SERVER_URL')}/{os.getenv('GITHUB_REPOSITORY')}/releases/latest"
response = client.create_tweet(text=tweet_text)
print(f"Tweet odeslán: {response}")
EOF

0 comments on commit 1c17760

Please sign in to comment.