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

Commit

Permalink
Merge branch 'delete-feed-generator'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsalterego committed Jun 4, 2023

Verified

This commit was signed with the committer’s verified signature.
rpearce Robert Pearce
2 parents 0b62e4a + b51999f commit ba386fa
Showing 4 changed files with 65 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/03-publish-feed-generator.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ env:
jobs:
publish_feed_generator:
runs-on: ubuntu-latest
name: Publish Feed
name: Publish Feed Generator
steps:
- name: Get Cloudflare Worker Subdomain
run: |
28 changes: 28 additions & 0 deletions .github/workflows/delete-feed-generator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Delete Feed Generator

on:
workflow_dispatch:
inputs:
record_name:
description: "Record Name"
required: true

env:
BLUESKY_HANDLE: ${{ vars.BLUESKY_HANDLE }}
BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }}

jobs:
publish_feed_generator:
runs-on: ubuntu-latest
name: Delete Feed Generator
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Delete Feed Generator
env:
RECORD_NAME: ${{ inputs.record_name }}
run: |
cd feed-generator/
npm install
echo ${RECORD_NAME}
yarn deleteFeedGenerator
35 changes: 35 additions & 0 deletions feed-generator/deleteFeedGenerator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import dotenv from 'dotenv'
import { AtpAgent, BlobRef } from '@atproto/api'

const run = async () => {
dotenv.config()
let config = require("./config.json");
const handle = `${process.env.BLUESKY_HANDLE}`
const password = `${process.env.BLUESKY_APP_PASSWORD}`
const recordName = `${process.env.RECORD_NAME}`

// only update this if in a test environment
const agent = new AtpAgent({ service: 'https://bsky.social' })
await agent.login({ identifier: handle, password })

try {
await agent.api.app.bsky.feed.describeFeedGenerator()
} catch (err) {
throw new Error(
'The bluesky server is not ready to accept published custom feeds yet',
)
}

let record = {
repo: agent.session?.did ?? '',
collection: 'app.bsky.feed.generator',
rkey: recordName,
}
let recordJSON = JSON.stringify(record, null, 2);
console.log(`Deleting record ${recordJSON}`)
let response = await agent.api.com.atproto.repo.deleteRecord(record);
let responseJSON = JSON.stringify(response, null, 2);
console.log(`Response: ${responseJSON}`)
}

run()
2 changes: 1 addition & 1 deletion feed-generator/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"license": "MIT",
"scripts": {
"publishFeedGenerator": "ts-node publishFeedGenerator.ts",
"deleteFeed": "ts-node deleteFeed.ts"
"deleteFeedGenerator": "ts-node deleteFeedGenerator.ts"
},
"dependencies": {
"@atproto/api": "^0.3.7",

0 comments on commit ba386fa

Please sign in to comment.