forked from cotes2020/jekyll-theme-chirpy
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:bestZwei/blog
# Conflicts: # .github/workflows/cd.yml # .github/workflows/ci.yml # .github/workflows/commitlint.yml # .github/workflows/publish.yml # .github/workflows/stale.yml # .github/workflows/style-lint.yml
- Loading branch information
Showing
31 changed files
with
806 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
branches: [production] | ||
tags-ignore: ["**"] | ||
|
||
jobs: | ||
release: | ||
if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }} | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3 | ||
bundler-cache: true | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
|
||
- run: npm install | ||
- run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} | ||
|
||
publish: | ||
needs: release | ||
uses: ./.github/workflows/publish.yml | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
BUILDER: ${{ secrets.BUILDER }} |
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,53 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- "hotfix/*" | ||
paths-ignore: | ||
- ".github/**" | ||
- "!.github/workflows/ci.yml" | ||
- .gitignore | ||
- "docs/**" | ||
- README.md | ||
- LICENSE | ||
pull_request: | ||
paths-ignore: | ||
- ".github/**" | ||
- "!.github/workflows/ci.yml" | ||
- .gitignore | ||
- "docs/**" | ||
- README.md | ||
- LICENSE | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
ruby: ["3.1", "3.2", "3.3"] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # for posts's lastmod | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
|
||
- name: Build Assets | ||
run: npm i && npm run build | ||
|
||
- name: Test Site | ||
run: bash tools/test.sh |
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,15 @@ | ||
name: Lint Commit Messages | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- "hotfix/*" | ||
pull_request: | ||
|
||
jobs: | ||
commitlint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: wagoid/commitlint-github-action@v6 |
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,25 @@ | ||
name: PR Filter | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
check-template: | ||
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check PR Content | ||
id: intercept | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const script = require('.github/workflows/scripts/pr-filter.js'); | ||
await script({ github, context, core }); |
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,23 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- docs | ||
workflow_call: | ||
secrets: | ||
GH_PAT: | ||
required: true | ||
BUILDER: | ||
required: true | ||
workflow_dispatch: | ||
|
||
jobs: | ||
launch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
curl -X POST -H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ | ||
https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \ | ||
-d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}' |
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,36 @@ | ||
function hasTypes(markdown) { | ||
return /## Type of change/.test(markdown) && /-\s\[x\]/i.test(markdown); | ||
} | ||
|
||
function hasDescription(markdown) { | ||
return ( | ||
/## Description/.test(markdown) && | ||
!/## Description\s*\n\s*(##|\s*$)/.test(markdown) | ||
); | ||
} | ||
|
||
module.exports = async ({ github, context, core }) => { | ||
const pr = context.payload.pull_request; | ||
const body = pr.body === null ? '' : pr.body; | ||
const markdown = body.replace(/<!--[\s\S]*?-->/g, ''); | ||
const action = context.payload.action; | ||
|
||
const isValid = | ||
markdown !== '' && hasTypes(markdown) && hasDescription(markdown); | ||
|
||
if (!isValid) { | ||
await github.rest.pulls.update({ | ||
...context.repo, | ||
pull_number: pr.number, | ||
state: 'closed' | ||
}); | ||
|
||
await github.rest.issues.createComment({ | ||
...context.repo, | ||
issue_number: pr.number, | ||
body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.` | ||
}); | ||
|
||
core.setFailed('PR content does not meet template requirements.'); | ||
} | ||
}; |
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,32 @@ | ||
name: "Close stale issues and PRs" | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # every day at 00:00 UTC | ||
|
||
permissions: | ||
issues: write | ||
pull-requests: write | ||
|
||
env: | ||
STALE_LABEL: inactive | ||
EXEMPT_LABELS: "pending,planning,in progress" | ||
MESSAGE: > | ||
This conversation has been automatically marked as stale because it has not had recent activity. | ||
It will be closed if no further activity occurs. | ||
Thank you for your contributions. | ||
jobs: | ||
stale: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@v9 | ||
with: | ||
# 60 days before marking issues/PRs stale | ||
days-before-close: -1 # does not close automatically | ||
stale-issue-label: ${{ env.STALE_LABEL }} | ||
exempt-issue-labels: ${{ env.EXEMPT_LABELS }} | ||
stale-issue-message: ${{ env.MESSAGE }} | ||
stale-pr-label: ${{ env.STALE_LABEL }} | ||
exempt-pr-labels: ${{ env.EXEMPT_LABELS }} | ||
stale-pr-message: ${{ env.MESSAGE }} |
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,25 @@ | ||
name: Style Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- "hotfix/*" | ||
paths: ["_sass/**/*.scss"] | ||
pull_request: | ||
paths: ["_sass/**/*.scss"] | ||
|
||
jobs: | ||
stylelint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- run: npm i | ||
- run: npm test |
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
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,10 @@ | ||
{% comment %} | ||
Determine TOC state and return it through variable "enable_toc" | ||
{% endcomment %} | ||
|
||
{% assign enable_toc = false %} | ||
{% if site.toc and page.toc %} | ||
{% if page.content contains '<h2' or page.content contains '<h3' %} | ||
{% assign enable_toc = true %} | ||
{% endif %} | ||
{% endif %} |
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
Oops, something went wrong.