embed any codes from github

with full url

1
{% github https://github.com/dimaslanjaka/static-blog-generator/blob/e8ef351552d57c5e28e016e39e78fef139a8e7b2/.github/workflows/build-beta.yml#L152-L158 %}
yaml
1
2
3
4
5
6
7
8
run: |
git config --global user.email "dimaslanjaka@gmail.com"
git config --global user.name "dimaslanjaka"
arr_variable=("sbg-api" "sbg-server" "sbg-utility" "sbg-cli" "static-blog-generator" "instant-indexing")
for i in "${arr_variable[@]}"
do
git add "packages/${i}/dist" &> /dev/null

without base url

embed tag without base url https://github.com/

1
{% github dimaslanjaka/static-blog-generator/blob/e8ef351552d57c5e28e016e39e78fef139a8e7b2/.github/workflows/build-beta.yml#L152-L158 %}
1
{% github dimaslanjaka/static-blog-generator/blob/e8ef351552d57c5e28e016e39e78fef139a8e7b2/.github/workflows/build-beta.yml#L152-L158 %}
yaml
1
2
3
4
5
6
7
8
run: |
git config --global user.email "dimaslanjaka@gmail.com"
git config --global user.name "dimaslanjaka"
arr_variable=("sbg-api" "sbg-server" "sbg-utility" "sbg-cli" "static-blog-generator" "instant-indexing")
for i in "${arr_variable[@]}"
do
git add "packages/${i}/dist" &> /dev/null

using object options

1
{% github repo:dimaslanjaka/static-blog-generator ref:e8ef351552d57c5e28e016e39e78fef139a8e7b2 file:.github/workflows/build-beta.yml line:#L152-L158 %}
property description sample value
repo github repository github_username/github_repo
file file path file path to embed
ref github refs commit hash or branch
line embed specific line 152-158 or #L152-L158
yaml
1
2
3
4
5
6
7
8
run: |
git config --global user.email "dimaslanjaka@gmail.com"
git config --global user.name "dimaslanjaka"
arr_variable=("sbg-api" "sbg-server" "sbg-utility" "sbg-cli" "static-blog-generator" "instant-indexing")
for i in "${arr_variable[@]}"
do
git add "packages/${i}/dist" &> /dev/null

using object options - line without #L

1
{% github repo:dimaslanjaka/static-blog-generator ref:e8ef351552d57c5e28e016e39e78fef139a8e7b2 file:.github/workflows/build-beta.yml line:152-158 %}
yaml
1
2
3
4
5
6
7
8
run: |
git config --global user.email "dimaslanjaka@gmail.com"
git config --global user.name "dimaslanjaka"
arr_variable=("sbg-api" "sbg-server" "sbg-utility" "sbg-cli" "static-blog-generator" "instant-indexing")
for i in "${arr_variable[@]}"
do
git add "packages/${i}/dist" &> /dev/null

Language matcher test

pretext from hexo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
name: Build Beta

on:
push:
branches: ['beta']
paths-ignore:
- '**/dist/**'
- '**/release/**'
- 'packages/google-news-sitemap'
- 'packages/hexo-post-parser'
- 'packages/git-command-helper'
- 'packages/safelinkify'
- 'packages/hexo-blogger-xml'
- '**/test/**'
pull_request:
types:
- closed
workflow_dispatch:

pretext from plugin

yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Build Beta

on:
push:
branches: ['beta']
paths-ignore:
- '**/dist/**'
- '**/release/**'
- 'packages/google-news-sitemap'
- 'packages/hexo-post-parser'
- 'packages/git-command-helper'
- 'packages/safelinkify'
- 'packages/hexo-blogger-xml'
- '**/test/**'
pull_request:
types:
- closed
workflow_dispatch:

# run single job
concurrency:
group: build
cancel-in-progress: true

jobs:
build:
strategy:
fail-fast: true
env:
NODE_OPTIONS: '--max-old-space-size=8192'
YARN_ENABLE_IMMUTABLE_INSTALLS: false
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
repository: dimaslanjaka/static-blog-generator
ref: beta
token: ${{ secrets.ACCESS_TOKEN }}
submodules: 'recursive'
#- run: sh scripts/install-submodules.sh
#name: clone submodules

- name: Set EOL git configs
continue-on-error: true
run: |
git config core.eol lf
git config core.autocrlf input
git checkout-index --force --all

- uses: actions/setup-node@v3
with:
node-version: 18.x
token: ${{ secrets.GITHUB_TOKEN }}
architecture: x64
#cache: 'yarn'
#cache-dependency-path: '**/yarn.lock'

- name: Enable corepack
run: |
corepack enable
corepack prepare yarn@3.2.0 --activate

- name: Set env
id: set-env
shell: bash
run: |
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
echo "GITHUB_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GITHUB_COMMIT_URL=https://github.com/${{github.repository}}/commit/$(echo $GITHUB_SHA)" >> $GITHUB_ENV
echo "GITHUB_RUNNER_URL=https://github.com/${{github.repository}}/commit/${{github.sha}}/checks/${{github.run_id}}" >> $GITHUB_ENV
echo "CACHE_NPM=$(npm config get cache)" >> $GITHUB_ENV
echo "CACHE_YARN2=$(yarn config get cacheFolder || echo \".yarn\")" >> $GITHUB_ENV
echo "cache-npm=$(npm config get cache)" >> $GITHUB_OUTPUT
echo "cache-yarn2=$(yarn config get cacheFolder || echo \".yarn\")" >> $GITHUB_OUTPUT
#echo "cache-yarn=$(yarn cache dir || echo \".yarn\")" >> $GITHUB_OUTPUT
#echo "CACHE_YARN=$(yarn cache dir || echo \".yarn\")" >> $GITHUB_ENV

- name: Get env
shell: bash
run: |
echo "branch : ${{ env.GITHUB_BRANCH }}"
echo "commit msg : ${{ github.event.head_commit.message }}"
echo "commit hash : ${{ env.GITHUB_SHA_SHORT }}"
echo "commit url : ${{ env.GITHUB_COMMIT_URL }}"
echo "runner url : ${{ env.GITHUB_RUNNER_URL }}"
echo "cache npm : ${{ env.CACHE_NPM }}"
echo "cache yarn2 : ${{ env.CACHE_YARN2 }}"
#echo "cache yarn : ${{ env.CACHE_YARN }}"

- uses: actions/cache@v3 # pat-s/always-upload-cache@v3.0.11
id: cache
name: get caches
with:
path: |
${{ steps.set-env.outputs.cache-npm }}
${{ steps.set-env.outputs.cache-yarn2 }}
#${{ steps.set-env.outputs.cache-yarn }}
#./packages/sbg-server/src/public
#**/tmp/**
#**/node_modules/**
#**/.yarn
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-

- name: Install Global Packages
run: npm i -g typescript ts-node gulp-cli hexo-cli webpack-cli npm-run-all depcheck lerna husky

- run: yarn install
- run: |
arr_variable=("sbg-api" "sbg-server" "sbg-utility" "sbg-cli" "static-blog-generator" "instant-indexing")
for i in "${arr_variable[@]}"
do
yarn workspace $i build && yarn workspace $i run pack
done
shell: bash
name: build
- run: npx sbg clean all
working-directory: test
name: test clean
- run: npx sbg post standalone
working-directory: test
name: test post standalone
- run: npx sbg post copy
working-directory: test
name: test post copy
- run: npx hexo generate
working-directory: test
name: test generate site with hexo
- run: npx sbg generate feed
working-directory: test
name: test generate feed
- run: npx sbg generate sitemap
working-directory: test
name: test generate sitemap
- run: npx sbg deploy copy
working-directory: test
name: test copy generated site to deployment directory
- run: |
git status
echo "cached=$(git diff --cached --numstat | wc -l)" >> $GITHUB_OUTPUT
echo "commits=$(git diff origin/master..HEAD --numstat | wc -l)" >> $GITHUB_OUTPUT
name: what changes
id: changes
- name: commit and push
if: steps.changes.outputs.cached > 0 || steps.changes.outputs.commits > 0
shell: bash
run: |
git config --global user.email "dimaslanjaka@gmail.com"
git config --global user.name "dimaslanjaka"
arr_variable=("sbg-api" "sbg-server" "sbg-utility" "sbg-cli" "static-blog-generator" "instant-indexing")
for i in "${arr_variable[@]}"
do
git add "packages/${i}/dist" &> /dev/null
git add "packages/${i}/release" &> /dev/null
git commit -m "chore: build ${i} from ${{ env.GITHUB_COMMIT_URL }} runner ${{ env.GITHUB_RUNNER_URL }}" &> /dev/null
done
# git submodule foreach "git add dist release"
# git push --recurse-submodules=on-demand
git push &> /dev/null


avatar
Dimas Lanjaka (L3n4r0x)
All in one collection shortcodes for hexo
Follow Me
Announcement
This is my Blog
Recent Post
Info
Article :
0
UV :
PV :
Last Push :