This repository was archived by the owner on Aug 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'delete-feed-generator'
- Loading branch information
Showing
4 changed files
with
65 additions
and
2 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
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,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 |
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,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() |
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