Skip to content

Commit 5a036f7

Browse files
committed
let’s gooooooo
Signed-off-by: Daniel Sieradski <[email protected]>
1 parent e3ee4e8 commit 5a036f7

File tree

18 files changed

+673
-45
lines changed

18 files changed

+673
-45
lines changed

.github/workflows/feedbot.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: FeedBot
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
rss-to-mastodon:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Generate cache key
9+
uses: actions/github-script@v6
10+
id: generate-key
11+
with:
12+
script: |
13+
core.setOutput('cache-key', new Date().valueOf())
14+
- name: Retrieve cache
15+
uses: actions/cache@v2
16+
with:
17+
path: ${{ github.workspace }}/mastofeedbot
18+
key: feed-cache-i-${{ steps.generate-key.outputs.cache-key }}
19+
restore-keys: feed-cache-i-
20+
- name: GitHub
21+
uses: 'selfagency/slackfeedbot@main'
22+
with:
23+
rss-feed: https://www.githubstatus.com/history.rss
24+
api-endpoint: https://kibitz.cloud/api/v1/
25+
api-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
26+
cache-file: ${{ github.workspace }}/mastofeedbot/cache.json

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
pull-requests: read
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 16
22+
23+
- name: Check package version
24+
id: check
25+
uses: 'EndBug/version-check@v1'
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
diff-search: true
29+
30+
# - name: Generate changelog
31+
# id: changelog
32+
# uses: 'mikepenz/release-changelog-builder-action@v2'
33+
# if: ${{ steps.check.outputs.changed == 'true' }}
34+
# env:
35+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
# continue-on-error: true
37+
38+
- name: Create release
39+
uses: 'zendesk/action-create-release@v1'
40+
if: ${{ steps.check.outputs.changed == 'true' }}
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
tag_name: v${{ steps.check.outputs.version}}
45+
# body: ${{ steps.changelog.outputs.changelog }}
46+
release_name: v${{ steps.check.outputs.version}}
47+
draft: false
48+
prerelease: false

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
.LSOverride
2828

2929
# Icon must end with two \r
30-
Icon
30+
Icon
31+
3132

3233
# Thumbnails
3334
._*
@@ -144,7 +145,6 @@ out
144145

145146
# Nuxt.js build / generate output
146147
.nuxt
147-
dist
148148

149149
# Gatsby files
150150
.cache/

.idea/vcs.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Mastofeedbot
2+
3+
Mastofeedbot is a bot that posts RSS feeds to Mastodon via GitHub Actions.
4+
5+
## Usage
6+
7+
```yaml
8+
name: FeedBot
9+
on:
10+
schedule:
11+
- cron: '*/5 * * * *'
12+
jobs:
13+
rss-to-mastodon:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Generate cache key
17+
uses: actions/github-script@v6
18+
id: generate-key
19+
with:
20+
script: |
21+
core.setOutput('cache-key', new Date().valueOf())
22+
- name: Retrieve cache
23+
uses: actions/cache@v2
24+
with:
25+
path: ${{ github.workspace }}/mastofeedbot
26+
key: feed-cache-${{ steps.generate-key.outputs.cache-key }}
27+
restore-keys: feed-cache-
28+
- name: GitHub
29+
uses: 'selfagency/slackfeedbot@main'
30+
with:
31+
rss-feed: https://www.githubstatus.com/history.rss
32+
api-endpoint: https://mastodon.social
33+
api-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
34+
cache-file: ${{ github.workspace }}/mastofeedbot/cache.json
35+
```
36+

action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'MastoFeedBot'
2+
author: 'selfagency'
3+
description: 'Push RSS feed updates to Mastodon via GitHub Actions'
4+
branding:
5+
icon: 'rss'
6+
color: 'orange'
7+
inputs:
8+
rss-feed:
9+
description: 'RSS feed URL'
10+
required: true
11+
cache-file:
12+
description: 'Cache file'
13+
required: true
14+
cache-limit:
15+
description: 'Cache limit'
16+
required: false
17+
default: '100'
18+
api-endpoint:
19+
description: 'Mastodon API endpoint'
20+
required: true
21+
api-token:
22+
description: 'Mastodon access token'
23+
required: true
24+
runs:
25+
using: 'node16'
26+
main: 'dist/index.js'

dist/index.js

Lines changed: 53 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@selfagency/mastofeedbot",
3+
"version": "0.1.0",
4+
"description": "A bot to syndicate RSS to Mastodon via GitHub Actions",
5+
"author": "Daniel Sieradski <[email protected]>",
6+
"license": "MIT",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/selfagency/mastofeedbot.git"
10+
},
11+
"keywords": [
12+
"mastodon",
13+
"fediverse",
14+
"bot",
15+
"rss"
16+
],
17+
"bugs": {
18+
"url": "https://github.com/selfagency/mastofeedbot/issues"
19+
},
20+
"homepage": "https://github.com/selfagency/mastofeedbot#readme",
21+
"type": "module",
22+
"main": "dist/index.js",
23+
"scripts": {
24+
"build": "node --es-module-specifier-resolution node esbuild.js"
25+
},
26+
"devDependencies": {
27+
"@types/feedparser": "^2.2.5",
28+
"@types/node": "^18.11.9",
29+
"@typescript-eslint/eslint-plugin": "^5.43.0",
30+
"@typescript-eslint/parser": "^5.43.0",
31+
"esbuild": "^0.15.14",
32+
"esbuild-plugin-clean": "^0.9.0",
33+
"esbuild-plugin-copy-file": "^0.0.2",
34+
"esbuild-plugin-fileloc": "^0.0.6",
35+
"eslint": "^8.27.0",
36+
"eslint-config-prettier": "^8.5.0",
37+
"eslint-config-standard": "^17.0.0",
38+
"prettier": "^2.7.1",
39+
"typescript": "^4.9.3"
40+
},
41+
"dependencies": {
42+
"@actions/core": "^1.10.0",
43+
"@sohailalam2/abu": "^0.4.0",
44+
"masto": "^4.6.2",
45+
"rss-url-parser": "^2.2.4"
46+
}
47+
}

0 commit comments

Comments
 (0)