Skip to content

Commit

Permalink
🕰️
Browse files Browse the repository at this point in the history
  • Loading branch information
katydecorah committed Jun 19, 2024
0 parents commit 31f2c33
Show file tree
Hide file tree
Showing 58 changed files with 71,565 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/actions/post-template-basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ${title} Books

${bookMarkdown}

---

${radomVarThatWontWork}
21 changes: 21 additions & 0 deletions .github/actions/post-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: ${title}
image: ${image}
${bookYaml}
${bookmarkYaml}
${playlistYaml}
---

The books I read, playlist I made, and bookmarks I saved during ${title}.

## Books

${bookMarkdown}

## Playlist

${playlistMarkdown}

## Bookmarks

${bookmarkMarkdown}
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build
run-name: Build ${{ github.ref_name }} by @${{ github.actor }}

on:
workflow_dispatch:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
- run: npm ci
- run: rm -rf dist/*
- run: npm run build
- name: Commit files
run: |
git pull
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add dist
if git diff --staged --quiet; then
echo "::notice::No changes to commit"
else
git commit -m "Build action"
git push
fi
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Test

on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- run: npm ci
- run: npm test
env:
CI: true
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '37 13 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
37 changes: 37 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Document GitHub action

on:
push:
paths:
- ".github/workflows/scheduled.yml"
- ".github/workflows/scheduled-advanced.yml"
- ".github/workflows/scheduled-own-template.yml"
- ".github/workflows/documentation.yml"
- "action.yml"
- "package.json"
- "README.md"

permissions:
contents: write

jobs:
documentation:
runs-on: ubuntu-latest
name: Write documentation
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Documentation action
id: documentation
uses: katydecorah/[email protected]
with:
example-workflow-file: "scheduled.yml"
additional-workflow-file-prefix: "scheduled"
- name: Commit files
if: steps.documentation.outputs.update == 'true'
run: |
git pull
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Update documentation"
git push
76 changes: 76 additions & 0 deletions .github/workflows/scheduled-advanced.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Seasonal scheduled post

on:
workflow_dispatch:
schedule:
- cron: "00 02 20 Mar,Jun,Sep,Dec *"

jobs:
scheduled-post:
runs-on: ubuntu-latest
name: Write scheduled post
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set post title and dates
run: |
MONTH=$(date +%m)
YEAR=$(date +%Y)
declare -A SEASONS=(
["03"]="Winter"
["06"]="Spring"
["09"]="Summer"
["12"]="Fall"
)
set_env_vars() {
local season=$1
local start_date=$2
local end_date=$3
local post_title=""
if [ "$season" = "Winter" ]; then
post_title="$(($YEAR - 1))/${YEAR} ${season}"
else
post_title="${YEAR} ${season}"
fi
echo "POST_TITLE=${post_title}" >> $GITHUB_ENV
echo "START_DATE=${start_date}" >> $GITHUB_ENV
echo "END_DATE=${end_date}" >> $GITHUB_ENV
}
case $MONTH in
"03")
set_env_vars ${SEASONS[$MONTH]} "$(($YEAR - 1))-12-21" "${YEAR}-03-20"
;;
"06")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-03-21" "${YEAR}-06-20"
;;
"09")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-06-21" "${YEAR}-09-20"
;;
"12")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-09-21" "${YEAR}-12-20"
;;
esac
- name: Write scheduled post
uses: ./
with:
github-username: katydecorah
github-repository: archive
source-bookmarks: recipes|_data/recipes.json
book-tags: "recommend,skip"
start-date: ${{ env.START_DATE }}
end-date: ${{ env.END_DATE }}
post-title: ${{ env.POST_TITLE }}
env:
TOKEN: ${{ secrets.TOKEN }}
- 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 "${{ env.POST_TITLE }}"
git push
42 changes: 42 additions & 0 deletions .github/workflows/scheduled-own-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Uses a custom markdown template (`post-template`) and customizes the `posts-directory`, with a manual workflow trigger.

on:
workflow_dispatch:
inputs:
start-date:
description: "The start date for the post in the format YYYY-MM-DD"
type: string
required: true
end-date:
description: "The end date for the post in the format YYYY-MM-DD"
type: string
required: true
post-title:
description: "The title of the post"
type: string
required: true

jobs:
scheduled-post:
runs-on: ubuntu-latest
name: Write scheduled post
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Write scheduled post
uses: ./
with:
github-username: katydecorah
github-repository: archive
post-template: .github/actions/post-template-basic.md
posts-directory: books/
source-bookmarks: recipes|_data/recipes.json
env:
TOKEN: ${{ secrets.TOKEN }}
- 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 "${{ env.title }}"
git push
33 changes: 33 additions & 0 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Scheduled post

# Grant the action permission to write to the repository
permissions:
contents: write
pull-requests: write

on:
schedule:
- cron: "00 02 20 Mar,Jun,Sep,Dec *"

jobs:
scheduled-post:
runs-on: ubuntu-latest
name: Write scheduled post
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Write scheduled post
uses: ./
with:
github-username: katydecorah
github-repository: archive
source-bookmarks: recipes|_data/recipes.json
env:
TOKEN: ${{ secrets.TOKEN }}
- 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 "${{ env.title }}"
git push
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"files.exclude": {
"**/.dist": true
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Katy DeCorah

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 31f2c33

Please sign in to comment.