Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/library-pals/bookmark-action
🔖 A GitHub action to bookmark websites to a JSON file
https://github.com/library-pals/bookmark-action
github-actions
Last synced: 3 months ago
JSON representation
🔖 A GitHub action to bookmark websites to a JSON file
- Host: GitHub
- URL: https://github.com/library-pals/bookmark-action
- Owner: library-pals
- License: mit
- Created: 2021-03-07T19:30:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-27T12:26:34.000Z (6 months ago)
- Last Synced: 2024-05-27T13:54:50.332Z (6 months ago)
- Topics: github-actions
- Language: TypeScript
- Homepage: https://katydecorah.com/code/bookmark-action/
- Size: 5.41 MB
- Stars: 25
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bookmark-action
This GitHub action bookmarks websites to a JSON file. Pair it with the [iOS Shortcut](shortcut/README.md) or click **Run workflow** from the Actions tab to submit details for the bookmark.
[Create a workflow dispatch event](https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event) with basic information about the bookmark. The action will then fetch the web page's metadata using [open-graph-scraper](https://www.npmjs.com/package/open-graph-scraper) and add it to your JSON file in your repository, always sorting by the bookmark date.
## Set up the workflow
To use this action, create a new workflow in `.github/workflows` and modify it as needed:
```yml
name: Add bookmark
run-name: Add bookmark (${{ inputs.url }})on:
workflow_dispatch:
inputs:
url:
description: The URL to bookmark.
required: true
type: string
notes:
description: Notes about the bookmark.
type: string
date:
description: Date (YYYY-MM-DD). The default date is today.
type: string
tags:
description: Add tags to categorize the book. Separate each tag with a comma. Optional.
type: stringpermissions:
contents: writejobs:
add-bookmark:
runs-on: ubuntu-latest
name: Add bookmark
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Bookmark action
uses: library-pals/[email protected]
with:
filename: _data/recipes.json
- name: Download the thumbnail image
run: curl "${{ env.BookmarkImage }}" -o "img/${{ env.BookmarkImageOutput }}"
if: env.BookmarkImage != ''
- name: Commit files
run: |
git pull
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A && git commit -m "Bookmark ${{ env.BookmarkTitle }}"
git push
```### Additional example workflows
Add bookmark with additional properties
```yml
name: Add bookmark with additional properties
run-name: Add bookmark (${{ inputs.url }})on:
workflow_dispatch:
inputs:
url:
description: The URL to bookmark.
required: true
type: string
notes:
description: Notes about the bookmark.
type: string
date:
description: Date (YYYY-MM-DD). The default date is today.
type: string
tags:
description: Add tags to categorize the bookmark. Separate each tag with a comma. Optional.
type: string
# The following property names are defined by the task input "additional-properties"
rating:
description: Rate the bookmark from 1 to 5. Optional.
type: string
quote:
description: Add a quote from the bookmark. Optional.
type: stringpermissions:
contents: writejobs:
add-bookmark:
runs-on: ubuntu-latest
name: Add bookmark
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Bookmark action
uses: library-pals/[email protected]
with:
filename: _data/recipes.json
# You can define additional properties you want to pass through
additional-properties: rating,quote
- name: Download the thumbnail image
run: curl "${{ env.BookmarkImage }}" -o "img/${{ env.BookmarkImageOutput }}"
if: env.BookmarkImage != ''
- name: Commit files
run: |
git pull
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A && git commit -m "Bookmark ${{ env.BookmarkTitle }}"
git push
```## Action options
- `filename`: The filename to save your bookmarks. Default: `_data/bookmarks.json`.
- `export-image`: Export the URL's `image` to download later and set `image` property. Default: `true`.
- `additional-properties`: Additional properties to add to the bookmark from the workflow payload formatted as a comma delimited string.
## Trigger the action
To trigger the action, [create a workflow dispatch event](https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event) with the following body parameters:
```js
{
"ref": "main", // Required. The git reference for the workflow, a branch or tag name.
"inputs": {
"url": "", // Required. The URL to bookmark.
"notes": "", // Notes about the bookmark.
"date": "", // Date (YYYY-MM-DD). The default date is today.
"tags": "", // Add tags to categorize the book. Separate each tag with a comma. Optional.
}
}
```