-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Daniel Sieradski <[email protected]>
- Loading branch information
1 parent
e3ee4e8
commit 5a036f7
Showing
18 changed files
with
673 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: FeedBot | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
rss-to-mastodon: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate cache key | ||
uses: actions/github-script@v6 | ||
id: generate-key | ||
with: | ||
script: | | ||
core.setOutput('cache-key', new Date().valueOf()) | ||
- name: Retrieve cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ github.workspace }}/mastofeedbot | ||
key: feed-cache-i-${{ steps.generate-key.outputs.cache-key }} | ||
restore-keys: feed-cache-i- | ||
- name: GitHub | ||
uses: 'selfagency/slackfeedbot@main' | ||
with: | ||
rss-feed: https://www.githubstatus.com/history.rss | ||
api-endpoint: https://kibitz.cloud/api/v1/ | ||
api-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} | ||
cache-file: ${{ github.workspace }}/mastofeedbot/cache.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: read | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Check package version | ||
id: check | ||
uses: 'EndBug/version-check@v1' | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
diff-search: true | ||
|
||
# - name: Generate changelog | ||
# id: changelog | ||
# uses: 'mikepenz/release-changelog-builder-action@v2' | ||
# if: ${{ steps.check.outputs.changed == 'true' }} | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# continue-on-error: true | ||
|
||
- name: Create release | ||
uses: 'zendesk/action-create-release@v1' | ||
if: ${{ steps.check.outputs.changed == 'true' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.check.outputs.version}} | ||
# body: ${{ steps.changelog.outputs.changelog }} | ||
release_name: v${{ steps.check.outputs.version}} | ||
draft: false | ||
prerelease: false |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Mastofeedbot | ||
|
||
Mastofeedbot is a bot that posts RSS feeds to Mastodon via GitHub Actions. | ||
|
||
## Usage | ||
|
||
```yaml | ||
name: FeedBot | ||
on: | ||
schedule: | ||
- cron: '*/5 * * * *' | ||
jobs: | ||
rss-to-mastodon: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate cache key | ||
uses: actions/github-script@v6 | ||
id: generate-key | ||
with: | ||
script: | | ||
core.setOutput('cache-key', new Date().valueOf()) | ||
- name: Retrieve cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ github.workspace }}/mastofeedbot | ||
key: feed-cache-${{ steps.generate-key.outputs.cache-key }} | ||
restore-keys: feed-cache- | ||
- name: GitHub | ||
uses: 'selfagency/slackfeedbot@main' | ||
with: | ||
rss-feed: https://www.githubstatus.com/history.rss | ||
api-endpoint: https://mastodon.social | ||
api-token: ${{ secrets.MASTODON_ACCESS_TOKEN }} | ||
cache-file: ${{ github.workspace }}/mastofeedbot/cache.json | ||
``` | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'MastoFeedBot' | ||
author: 'selfagency' | ||
description: 'Push RSS feed updates to Mastodon via GitHub Actions' | ||
branding: | ||
icon: 'rss' | ||
color: 'orange' | ||
inputs: | ||
rss-feed: | ||
description: 'RSS feed URL' | ||
required: true | ||
cache-file: | ||
description: 'Cache file' | ||
required: true | ||
cache-limit: | ||
description: 'Cache limit' | ||
required: false | ||
default: '100' | ||
api-endpoint: | ||
description: 'Mastodon API endpoint' | ||
required: true | ||
api-token: | ||
description: 'Mastodon access token' | ||
required: true | ||
runs: | ||
using: 'node16' | ||
main: 'dist/index.js' |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "@selfagency/mastofeedbot", | ||
"version": "0.1.0", | ||
"description": "A bot to syndicate RSS to Mastodon via GitHub Actions", | ||
"author": "Daniel Sieradski <[email protected]>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/selfagency/mastofeedbot.git" | ||
}, | ||
"keywords": [ | ||
"mastodon", | ||
"fediverse", | ||
"bot", | ||
"rss" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/selfagency/mastofeedbot/issues" | ||
}, | ||
"homepage": "https://github.com/selfagency/mastofeedbot#readme", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "node --es-module-specifier-resolution node esbuild.js" | ||
}, | ||
"devDependencies": { | ||
"@types/feedparser": "^2.2.5", | ||
"@types/node": "^18.11.9", | ||
"@typescript-eslint/eslint-plugin": "^5.43.0", | ||
"@typescript-eslint/parser": "^5.43.0", | ||
"esbuild": "^0.15.14", | ||
"esbuild-plugin-clean": "^0.9.0", | ||
"esbuild-plugin-copy-file": "^0.0.2", | ||
"esbuild-plugin-fileloc": "^0.0.6", | ||
"eslint": "^8.27.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"prettier": "^2.7.1", | ||
"typescript": "^4.9.3" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.0", | ||
"@sohailalam2/abu": "^0.4.0", | ||
"masto": "^4.6.2", | ||
"rss-url-parser": "^2.2.4" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import fileloc from 'esbuild-plugin-fileloc'; | ||
import { clean } from 'esbuild-plugin-clean'; | ||
import copyFilePlugin from 'esbuild-plugin-copy-file'; | ||
import esbuild from 'esbuild'; | ||
|
||
const banner = ` | ||
import {createRequire} from 'module'; | ||
const require = createRequire(import.meta.url); | ||
`; | ||
|
||
esbuild | ||
.build({ | ||
entryPoints: ['./src/index.ts'], | ||
platform: 'node', | ||
target: 'node16', | ||
bundle: true, | ||
plugins: [ | ||
clean({ | ||
patterns: ['./dist/*'] | ||
}), | ||
fileloc.filelocPlugin(), | ||
copyFilePlugin({ | ||
after: { | ||
'./dist/package.json': './package.json' | ||
} | ||
}) | ||
], | ||
loader: { | ||
'.ts': 'ts', | ||
'.js': 'js', | ||
'.cjs': 'js' | ||
}, | ||
outdir: 'dist', | ||
external: ['package.json'], | ||
minify: true, | ||
sourcemap: true, | ||
format: 'esm', | ||
banner: { | ||
js: banner | ||
} | ||
}) | ||
.catch(error => { | ||
console.error(error.message); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.