Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mill413 committed Nov 20, 2024
2 parents 7ffda85 + 65f960c commit 4fb7888
Show file tree
Hide file tree
Showing 53 changed files with 992 additions and 506 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ name: CD

on:
push:
branches:
- production
tags-ignore:
- "**"
branches: [production]
tags-ignore: ["**"]

jobs:
release:
if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }}
permissions:
contents: write
issues: write
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
name: "CI"
name: CI

on:
push:
branches:
- "master"
- "hotfix/**"
- master
- "hotfix/*"
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- ".gitignore"
- .gitignore
- "docs/**"
- "README.md"
- "LICENSE"
- README.md
- LICENSE
pull_request:
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- .gitignore
- "docs/**"
- README.md
- LICENSE

jobs:
build:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/pr-filter.yml
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 });
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
required: true
BUILDER:
required: true
workflow_dispatch:

jobs:
launch:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/scripts/pr-filter.js
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.');
}
};
6 changes: 4 additions & 2 deletions .github/workflows/style-lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: "Style Lint"
name: Style Lint

on:
push:
branches: ["master", "hotfix/**"]
branches:
- master
- "hotfix/*"
paths: ["_sass/**/*.scss"]
pull_request:
paths: ["_sass/**/*.scss"]
Expand Down
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo-data"
end

gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
gem "wdm", "~> 0.2.0", :platforms => [:mingw, :x64_mingw, :mswin]

# don't change it!
gem "jekyll-archives", path: "assets/jekyll-archives"
gem 'jekyll-compose', group: [:jekyll_plugins]
gem 'jekyll-compose', group: [:jekyll_plugins]
gem "logger"

1 change: 0 additions & 1 deletion _includes/analytics/cloudflare.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
src="https://static.cloudflareinsights.com/beacon.min.js"
data-cf-beacon='{"token": "{{ site.analytics.cloudflare.id }}"}'
></script>
<!-- End Cloudflare Web Analytics -->
5 changes: 2 additions & 3 deletions _includes/analytics/fathom.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
<script
src="https://cdn.usefathom.com/script.js"
data-site="{{ site.analytics.fathom.id }}"
defer>
</script>
<!-- End Fathom Code -->
defer
></script>
2 changes: 1 addition & 1 deletion _includes/analytics/google.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.id }}"></script>
<script>
document.addEventListener('DOMContentLoaded', function (event) {
document.addEventListener('DOMContentLoaded', () => {
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
Expand Down
13 changes: 6 additions & 7 deletions _includes/analytics/matomo.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
<script>
document.addEventListener('DOMContentLoaded', () => {
var _paq = (window._paq = window._paq || []);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
var u="//{{ site.analytics.matomo.domain }}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', {{ site.analytics.matomo.id }}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
});
</script>
<!-- End Matomo Code -->
File renamed without changes.
65 changes: 36 additions & 29 deletions _includes/comments/disqus.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
<!-- The Disqus lazy loading. -->

<div id="disqus_thread">
<p class="text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
</div>

<script type="text/javascript">
<script>
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}';
};

{%- comment -%} Lazy loading {%- endcomment -%}
var disqus_observer = new IntersectionObserver(
function (entries) {
if (entries[0].isIntersecting) {
(function () {
var d = document,
s = d.createElement('script');
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();

disqus_observer.disconnect();
}
},
{ threshold: [0] }
);
function addDisqus() {
let disqusThread = document.createElement('div');
let paragraph = document.createElement('p');

disqus_observer.observe(document.getElementById('disqus_thread'));
disqusThread.id = 'disqus_thread';
paragraph.className = 'text-center text-muted small';
paragraph.innerHTML = 'Comments powered by <a href="https://disqus.com/">Disqus</a>.';
disqusThread.appendChild(paragraph);

const footer = document.querySelector('footer');
footer.insertAdjacentElement("beforebegin", disqusThread);
}

{%- comment -%} Auto switch theme {%- endcomment -%}
function reloadDisqus() {
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
function reloadDisqus(event) {
if (event.source === window && event.data && event.data.id === Theme.ID) {
{%- comment -%} Disqus hasn't been loaded {%- endcomment -%}
if (typeof DISQUS === 'undefined') {
return;
Expand All @@ -44,7 +31,27 @@
}
}

if (document.getElementById('mode-toggle')) {
window.addEventListener('message', reloadDisqus);
addDisqus();

if (Theme.switchable) {
addEventListener('message', reloadDisqus);
}

{%- comment -%} Lazy loading {%- endcomment -%}
var disqusObserver = new IntersectionObserver(
function (entries) {
if (entries[0].isIntersecting) {
var d = document,
s = d.createElement('script');
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);

disqusObserver.disconnect();
}
},
{ threshold: [0] }
);

disqusObserver.observe(document.getElementById('disqus_thread'));
</script>
44 changes: 14 additions & 30 deletions _includes/comments/giscus.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
<!-- https://giscus.app/ -->
<script type="text/javascript">
<script>
(function () {
const origin = 'https://giscus.app';
const lightTheme = 'light';
const darkTheme = 'dark_dimmed';

let initTheme = lightTheme;
const html = document.documentElement;

if (
(html.hasAttribute('data-mode') &&
html.getAttribute('data-mode') === 'dark') ||
(!html.hasAttribute('data-mode') &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
initTheme = darkTheme;
}
const themeMapper = Theme.getThemeMapper('light', 'dark_dimmed');
const initTheme = themeMapper[Theme.visualState];

let lang = '{{ site.comments.giscus.lang | default: lang }}';
{%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%}
Expand All @@ -41,30 +28,27 @@
async: ''
};

let giscusScript = document.createElement('script');
let giscusNode = document.createElement('script');
Object.entries(giscusAttributes).forEach(([key, value]) =>
giscusScript.setAttribute(key, value)
giscusNode.setAttribute(key, value)
);
document.getElementById('tail-wrapper').appendChild(giscusScript);

const $footer = document.querySelector('footer');
$footer.insertAdjacentElement("beforebegin", giscusNode);

addEventListener('message', (event) => {
if (
event.source === window &&
event.data &&
event.data.direction === ModeToggle.ID
) {
{%- comment -%} global theme mode changed {%- endcomment -%}
const mode = event.data.message;
const theme = mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme;
if (event.source === window && event.data && event.data.id === Theme.ID) {
const newTheme = themeMapper[Theme.visualState];

const message = {
setConfig: {
theme: theme
theme: newTheme
}
};

const giscus = document.getElementsByClassName('giscus-frame')[0].contentWindow;
giscus.postMessage({ giscus: message }, origin);
const giscus =
document.getElementsByClassName('giscus-frame')[0].contentWindow;
giscus.postMessage({ giscus: message }, 'https://giscus.app');
}
});
})();
Expand Down
Loading

0 comments on commit 4fb7888

Please sign in to comment.