Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit ba386fa

Browse files
committed
Merge branch 'delete-feed-generator'
2 parents 0b62e4a + b51999f commit ba386fa

File tree

4 files changed

+65
-2
lines changed

4 files changed

+65
-2
lines changed

.github/workflows/03-publish-feed-generator.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
jobs:
1616
publish_feed_generator:
1717
runs-on: ubuntu-latest
18-
name: Publish Feed
18+
name: Publish Feed Generator
1919
steps:
2020
- name: Get Cloudflare Worker Subdomain
2121
run: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Delete Feed Generator
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
record_name:
7+
description: "Record Name"
8+
required: true
9+
10+
env:
11+
BLUESKY_HANDLE: ${{ vars.BLUESKY_HANDLE }}
12+
BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }}
13+
14+
jobs:
15+
publish_feed_generator:
16+
runs-on: ubuntu-latest
17+
name: Delete Feed Generator
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-node@v3
21+
- name: Delete Feed Generator
22+
env:
23+
RECORD_NAME: ${{ inputs.record_name }}
24+
run: |
25+
cd feed-generator/
26+
npm install
27+
echo ${RECORD_NAME}
28+
yarn deleteFeedGenerator

feed-generator/deleteFeedGenerator.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import dotenv from 'dotenv'
2+
import { AtpAgent, BlobRef } from '@atproto/api'
3+
4+
const run = async () => {
5+
dotenv.config()
6+
let config = require("./config.json");
7+
const handle = `${process.env.BLUESKY_HANDLE}`
8+
const password = `${process.env.BLUESKY_APP_PASSWORD}`
9+
const recordName = `${process.env.RECORD_NAME}`
10+
11+
// only update this if in a test environment
12+
const agent = new AtpAgent({ service: 'https://bsky.social' })
13+
await agent.login({ identifier: handle, password })
14+
15+
try {
16+
await agent.api.app.bsky.feed.describeFeedGenerator()
17+
} catch (err) {
18+
throw new Error(
19+
'The bluesky server is not ready to accept published custom feeds yet',
20+
)
21+
}
22+
23+
let record = {
24+
repo: agent.session?.did ?? '',
25+
collection: 'app.bsky.feed.generator',
26+
rkey: recordName,
27+
}
28+
let recordJSON = JSON.stringify(record, null, 2);
29+
console.log(`Deleting record ${recordJSON}`)
30+
let response = await agent.api.com.atproto.repo.deleteRecord(record);
31+
let responseJSON = JSON.stringify(response, null, 2);
32+
console.log(`Response: ${responseJSON}`)
33+
}
34+
35+
run()

feed-generator/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"license": "MIT",
1010
"scripts": {
1111
"publishFeedGenerator": "ts-node publishFeedGenerator.ts",
12-
"deleteFeed": "ts-node deleteFeed.ts"
12+
"deleteFeedGenerator": "ts-node deleteFeedGenerator.ts"
1313
},
1414
"dependencies": {
1515
"@atproto/api": "^0.3.7",

0 commit comments

Comments
 (0)