Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xorilog/twitter-action
Post tweet using this action !
https://github.com/xorilog/twitter-action
github-actions go golang twitter
Last synced: 7 days ago
JSON representation
Post tweet using this action !
- Host: GitHub
- URL: https://github.com/xorilog/twitter-action
- Owner: xorilog
- License: mit
- Created: 2019-01-25T13:55:26.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-22T16:19:33.000Z (over 3 years ago)
- Last Synced: 2024-08-01T16:36:06.168Z (3 months ago)
- Topics: github-actions, go, golang, twitter
- Language: Go
- Size: 7.81 KB
- Stars: 58
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
twitter-action
---
# Auth
About the authentication see: https://developer.twitter.com/en/apps
create an account, create an app
@see https://apps.twitter.com/# retrieve the access tokens
@see https://developer.twitter.com/en/apps# Use Action
```
workflow "on push tag, tweet message" {
on = "push"
resolves = ["Advertise tweetosphere with a message"]
}action "Advertise tweetosphere with a message" {
uses = "xorilog/twitter-action@master"
args = ["-message", "New version is out ! $GITHUB_REF"]
secrets = ["TWITTER_CONSUMER_KEY", "TWITTER_CONSUMER_SECRET", "TWITTER_ACCESS_TOKEN", "TWITTER_ACCESS_SECRET"]
}---
workflow "on push tag, tweet the content of a file" {
on = "push"
resolves = ["Advertise tweetosphere with the content of a file"]
}
action "Advertise tweetosphere with the content of a file" {
uses = "xorilog/twitter-action@master"
args = ["-file", "./my-tweet.yolo"]
secrets = ["TWITTER_CONSUMER_KEY", "TWITTER_CONSUMER_SECRET", "TWITTER_ACCESS_TOKEN", "TWITTER_ACCESS_SECRET"]
}---
workflow "on push tag, tweet message and file content" {
on = "push"
resolves = ["Advertise tweetosphere with a message and the content of a file"]
}
action "Advertise tweetosphere with a message and the content of a file" {
uses = "xorilog/twitter-action@master"
args = ["-message", "Here is the big news: ", "-file", "./my-tweet.yolo"]
secrets = ["TWITTER_CONSUMER_KEY", "TWITTER_CONSUMER_SECRET", "TWITTER_ACCESS_TOKEN", "TWITTER_ACCESS_SECRET"]
}
```# Build
```
go get .
go build
```
# Usage
## Message
```
export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_SECRET=xxx
./twitter-action -message "Hello Twitter :)"
```## File
> Read the content of the given file and send it as a tweet```
export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_SECRET=xxx
./twitter-action -file ~/my-tweet.yolo
```## Both
> This will concatenate the message and the content of the file given (handle the split yourself if needed)```
export TWITTER_CONSUMER_KEY=xxx
export TWITTER_CONSUMER_SECRET=xxx
export TWITTER_ACCESS_TOKEN=xxx
export TWITTER_ACCESS_SECRET=xxx
./twitter-action -message "Here is the big news: " -file ~/my-tweet.yolo
```
# Docker
```
# If building locally
docker build -t xorilog/twitter-action .# else:
docker run --rm -e TWITTER_CONSUMER_KEY=${TWITTER_CONSUMER_KEY} \
-e TWITTER_CONSUMER_SECRET=${TWITTER_CONSUMER_SECRET} \
-e TWITTER_ACCESS_TOKEN=${TWITTER_ACCESS_TOKEN} \
-e TWITTER_ACCESS_SECRET=${TWITTER_ACCESS_SECRET} \
xorilog/twitter-action -message "Hello Twitter :)"
```# Test
```
./twitter-action -message "Here is the big news: " -file ~/my-tweet.yolo -dry"
2019/03/28 16:04:47 Logging in, creating client and updating status.
2019/03/28 16:04:47 Status updated with: Here is the big news: I am file my-tweet.yolo and this is my content.
```