|
| 1 | +# 🔑 setting up x api credentials |
| 2 | + |
| 3 | +to use the x post action, you'll need to set up a developer account and create an app on x. |
| 4 | + |
| 5 | +## step 1: create a developer account |
| 6 | + |
| 7 | +1. go to the [x developer portal](https://developer.twitter.com/en/portal/dashboard) |
| 8 | +2. sign in with your x account |
| 9 | +3. apply for a developer account if you don't already have one |
| 10 | + |
| 11 | +## step 2: create a new app |
| 12 | + |
| 13 | +1. in the developer portal, navigate to "projects & apps" |
| 14 | +2. click "create app" |
| 15 | +3. fill in the required information about your app |
| 16 | +4. set the app permissions to "read and write" |
| 17 | + |
| 18 | +## step 3: generate access tokens |
| 19 | + |
| 20 | +1. from your app's dashboard, navigate to the "keys and tokens" tab |
| 21 | +2. generate consumer keys (app key and app secret) |
| 22 | +3. generate access token and access token secret |
| 23 | + |
| 24 | +## step 4: add credentials to github secrets |
| 25 | + |
| 26 | +1. in your github repository, go to settings > secrets and variables > actions |
| 27 | +2. click "new repository secret" |
| 28 | +3. add the following secrets: |
| 29 | + - `X_APP_KEY`: your app key |
| 30 | + - `X_APP_SECRET`: your app secret |
| 31 | + - `X_ACCESS_TOKEN`: your access token |
| 32 | + - `X_ACCESS_SECRET`: your access token secret |
| 33 | + |
| 34 | +## step 5: use secrets in your workflow |
| 35 | + |
| 36 | +reference the secrets in your workflow file: |
| 37 | + |
| 38 | +```yaml |
| 39 | +- name: post to x |
| 40 | + uses: captradeoff/x-post-action@v1 |
| 41 | + with: |
| 42 | + appKey: ${{ secrets.X_APP_KEY }} |
| 43 | + appSecret: ${{ secrets.X_APP_SECRET }} |
| 44 | + accessToken: ${{ secrets.X_ACCESS_TOKEN }} |
| 45 | + accessSecret: ${{ secrets.X_ACCESS_SECRET }} |
| 46 | + message: 'hello from github actions!' |
| 47 | +``` |
| 48 | +
|
| 49 | +## troubleshooting credentials |
| 50 | +
|
| 51 | +if you encounter authentication issues: |
| 52 | +
|
| 53 | +1. verify that all four credentials are correctly stored in github secrets |
| 54 | +2. ensure your app has "read and write" permissions |
| 55 | +3. check that your access tokens haven't expired |
| 56 | +4. make sure your developer account is in good standing |
| 57 | +5. verify that you haven't exceeded rate limits |
0 commit comments