One more raw #144
This file contains 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: Socialise new posts | |
on: push | |
jobs: | |
socialise-new-posts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: setup git config | |
run: | | |
git config user.name "Social bot" | |
git config user.email "<[email protected]>" | |
- name: get the social-poster code | |
run: | | |
git clone https://github.com/nottrobin/social-poster | |
- name: install python dependencies | |
run: | | |
pip3 install -r social-poster/requirements.txt | |
- name: send new posts to social media and email, update frontmatter | |
env: | |
HN_PASSWORD: ${{ secrets.HN_PASSWORD }} | |
HN_USERNAME: ${{ secrets.HN_USERNAME }} | |
TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} | |
TWITTER_API_KEY_SECRET: ${{ secrets.TWITTER_API_KEY_SECRET }} | |
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} | |
DEV_TO_API_KEY: ${{ secrets.DEV_TO_API_KEY }} | |
run: | | |
social-poster/process-recent-articles.py | |
- name: create a commit | |
run: | | |
if git diff-index --exit-code HEAD -- _articles/; then | |
echo "No changes. Not committing." | |
else | |
git add _articles/ | |
git commit -m "Added publish metadata" | |
fi | |
- name: push back to repo | |
run: | | |
git pull --rebase | |
git push |