Skip to content

Commit c1388e2

Browse files
authored
Merge pull request #173 from orionrobots/workflow-infra-fixes
Add a linting workflow
2 parents d92280b + d9f8bb3 commit c1388e2

17 files changed

+202
-214
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
tab_width = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*{sh,py}]
13+
indent_size = 4

.eleventy.js

+48-48
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ const {
1919

2020
const media_filetypes = "jpg,jpeg,JPG,png,gif,svg,avif";
2121

22-
module.exports = function(eleventyConfig) {
22+
module.exports = function (eleventyConfig) {
2323
// Configure markdown parser
24-
const markdownLib = markdownIt({html: true, typographer: true});
24+
const markdownLib = markdownIt({ html: true, typographer: true });
2525
markdownLib.use(markdownItAnchor);
2626
markdownLib.use(markdownItAttrs);
27-
27+
2828
eleventyConfig.setLibrary("md", markdownLib);
2929
eleventyConfig.addPlugin(fortawesomeBrandsPlugin);
3030
eleventyConfig.addPlugin(syntaxHighlight);
@@ -38,8 +38,8 @@ module.exports = function(eleventyConfig) {
3838
eleventyConfig.addPassthroughCopy("favicon.png");
3939
eleventyConfig.addPassthroughCopy("galleries/**/*." + media_filetypes);
4040
eleventyConfig.addPassthroughCopy("google5458abc1104b04dd.html");
41-
eleventyConfig.addPassthroughCopy({"htaccess": ".htaccess"});
42-
eleventyConfig.addPassthroughCopy({"content": "."}, {
41+
eleventyConfig.addPassthroughCopy({ "htaccess": ".htaccess" });
42+
eleventyConfig.addPassthroughCopy({ "content": "." }, {
4343
filter: ["**/*." + + media_filetypes],
4444
rename: function (path) {
4545
return path.replace("content/", "");
@@ -49,7 +49,7 @@ module.exports = function(eleventyConfig) {
4949
eleventyConfig.addWatchTarget("src/**/*");
5050
let $collectionApi = null;
5151

52-
eleventyConfig.addCollection("posts", function(collectionApi) {
52+
eleventyConfig.addCollection("posts", function (collectionApi) {
5353
$collectionApi = collectionApi;
5454
return collectionApi.getFilteredByGlob("_posts/*.md");
5555
});
@@ -58,55 +58,55 @@ module.exports = function(eleventyConfig) {
5858
dynamicPartials: false,
5959
});
6060

61-
eleventyConfig.addFilter("cssmin", function(code) {
61+
eleventyConfig.addFilter("cssmin", function (code) {
6262
return new CleanCSS({}).minify(code).styles;
6363
});
6464

65-
eleventyConfig.addShortcode("image", async function(src, alt, sizes) {
65+
eleventyConfig.addShortcode("image", async function (src, alt, sizes) {
6666
let metadata = await fetch_image(src);
6767

68-
let imageAttributes = {
69-
alt,
70-
sizes,
71-
loading: "lazy",
72-
decoding: "async",
73-
};
68+
let imageAttributes = {
69+
alt,
70+
sizes,
71+
loading: "lazy",
72+
decoding: "async",
73+
};
7474

75-
// You bet we throw an error on a missing alt (alt="" works okay)
76-
return Image.generateHTML(metadata, imageAttributes);
77-
});
75+
// You bet we throw an error on a missing alt (alt="" works okay)
76+
return Image.generateHTML(metadata, imageAttributes);
77+
});
7878

79-
eleventyConfig.addShortcode("img_responsive", async function(src, alt, sizes="100vw, 720, 820, 940, 1140, 1280") {
79+
eleventyConfig.addShortcode("img_responsive", async function (src, alt, sizes = "100vw, 720, 820, 940, 1140, 1280") {
8080
let metadata = await fetch_image(src);
81-
let imageAttributes = {
82-
alt,
83-
sizes,
81+
let imageAttributes = {
82+
alt,
83+
sizes,
8484
class: "img-responsive",
85-
loading: "lazy",
86-
decoding: "async",
87-
};
85+
loading: "lazy",
86+
decoding: "async",
87+
};
8888

89-
return Image.generateHTML(metadata, imageAttributes);
89+
return Image.generateHTML(metadata, imageAttributes);
9090
});
9191

92-
eleventyConfig.addShortcode("image_with_class", async function(src, alt, sizes, class_names) {
92+
eleventyConfig.addShortcode("image_with_class", async function (src, alt, sizes, class_names) {
9393
let metadata = await fetch_image(src);
9494

95-
if (sizes==undefined || sizes=="_") {
96-
sizes="720, 940, 1140, 1280, 2048";
95+
if (sizes == undefined || sizes == "_") {
96+
sizes = "720, 940, 1140, 1280, 2048";
9797
}
9898

99-
let imageAttributes = {
100-
alt,
101-
sizes,
99+
let imageAttributes = {
100+
alt,
101+
sizes,
102102
class: class_names,
103-
loading: "lazy",
104-
decoding: "async",
105-
};
103+
loading: "lazy",
104+
decoding: "async",
105+
};
106106

107-
// You bet we throw an error on a missing alt (alt="" works okay)
108-
return Image.generateHTML(metadata, imageAttributes);
109-
});
107+
// You bet we throw an error on a missing alt (alt="" works okay)
108+
return Image.generateHTML(metadata, imageAttributes);
109+
});
110110

111111
// Thumbnails
112112
eleventyConfig.addShortcode("thumbnail_for_post", thumbnails.thumbnail_for_post);
@@ -124,15 +124,15 @@ module.exports = function(eleventyConfig) {
124124
});
125125

126126
// Liquid filter to convert a date to a string
127-
eleventyConfig.addLiquidFilter("to_utc_string", date => date.toUTCString() );
127+
eleventyConfig.addLiquidFilter("to_utc_string", date => date.toUTCString());
128128

129129
// Liquid filter for long date string
130-
eleventyConfig.addLiquidFilter("date_to_long_string", function(date) {
130+
eleventyConfig.addLiquidFilter("date_to_long_string", function (date) {
131131
return date.toLocaleDateString("en-GB", { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
132132
});
133133

134134
// Universal filter for jsonify
135-
eleventyConfig.addFilter("jsonify", JSON.stringify );
135+
eleventyConfig.addFilter("jsonify", JSON.stringify);
136136

137137
eleventyConfig.addFilter("with_explicit_date", items => items.filter(item => "date" in item.data));
138138

@@ -142,14 +142,14 @@ module.exports = function(eleventyConfig) {
142142

143143
// Read the menu data from _config.yml and add it to the global data
144144
eleventyConfig.addGlobalData("menu", () => getDataFromConfigYaml("menu"));
145-
eleventyConfig.addGlobalData("site_title", () => getDataFromConfigYaml("title"));
146-
eleventyConfig.addGlobalData("site_tagline", () => getDataFromConfigYaml("tagline"));
147-
eleventyConfig.addGlobalData("production_url", () => getDataFromConfigYaml("production_url"));
148-
eleventyConfig.addGlobalData("JB", () => getDataFromConfigYaml("JB"));
149-
eleventyConfig.addGlobalData("author", () => getDataFromConfigYaml("author"));
150-
eleventyConfig.addGlobalData("now" , () => new Date());
151-
152-
eleventyConfig.addNunjucksFilter("date", function(date, format) {
145+
eleventyConfig.addGlobalData("site_title", () => getDataFromConfigYaml("title"));
146+
eleventyConfig.addGlobalData("site_tagline", () => getDataFromConfigYaml("tagline"));
147+
eleventyConfig.addGlobalData("production_url", () => getDataFromConfigYaml("production_url"));
148+
eleventyConfig.addGlobalData("JB", () => getDataFromConfigYaml("JB"));
149+
eleventyConfig.addGlobalData("author", () => getDataFromConfigYaml("author"));
150+
eleventyConfig.addGlobalData("now", () => new Date());
151+
152+
eleventyConfig.addNunjucksFilter("date", function (date, format) {
153153
return moment(date).format(format);
154154
});
155155

.gitattributes

+14-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
# Auto detect text files and perform LF normalization
2-
* text=lf
3-
4-
# Custom for Visual Studio
5-
*.cs diff=csharp
6-
*.sln merge=union
7-
*.csproj merge=union
8-
*.vbproj merge=union
9-
*.fsproj merge=union
10-
*.dbproj merge=union
11-
12-
# Standard to msysgit
13-
*.doc diff=astextplain
14-
*.DOC diff=astextplain
15-
*.docx diff=astextplain
16-
*.DOCX diff=astextplain
17-
*.dot diff=astextplain
18-
*.DOT diff=astextplain
19-
*.pdf diff=astextplain
20-
*.PDF diff=astextplain
21-
*.rtf diff=astextplain
22-
*.RTF diff=astextplain
1+
# Auto detect text files and perform LF normalization
2+
* text=lf
3+
4+
# Standard to msysgit
5+
*.doc diff=astextplain
6+
*.DOC diff=astextplain
7+
*.docx diff=astextplain
8+
*.DOCX diff=astextplain
9+
*.dot diff=astextplain
10+
*.DOT diff=astextplain
11+
*.pdf diff=astextplain
12+
*.PDF diff=astextplain
13+
*.rtf diff=astextplain
14+
*.RTF diff=astextplain

.github/dependabot.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ updates:
99
schedule:
1010
# Check for updates to GitHub Actions every week
1111
interval: "weekly"
12+
1213
- package-ecosystem: "npm"
1314
directory: "/"
1415
versioning-strategy: auto
@@ -18,3 +19,4 @@ updates:
1819
ignore:
1920
- dependency-name: "*"
2021
update-types: ["version-update:semver-patch"]
22+

.github/scripts/new_post.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ function create_post {
3030
local file_path="$1"
3131
echo "Creating post at $file_path"
3232
touch "$file_path"
33-
echo "---" >> "$file_path"
34-
echo "title: $POST_TITLE" >> "$file_path"
35-
echo "date: $POST_DATE" >> "$file_path"
36-
echo "draft: true" >> "$file_path"
37-
echo "---" >> "$file_path"
33+
(
34+
echo "---"
35+
echo "title: $POST_TITLE"
36+
echo "date: $POST_DATE"
37+
echo "draft: true"
38+
echo "---"
39+
) >"$file_path"
3840
}
3941

4042
function main {
@@ -47,5 +49,3 @@ function main {
4749
}
4850

4951
main
50-
51-

.github/workflows/on_call_build_site.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ jobs:
3131
tar -czf _site.tar.gz _site
3232
3333
- name: upload site artifact
34-
uses: actions/upload-artifact@v4
34+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3535
with:
3636
name: _site
3737
path: _site.tar.gz
3838
if-no-files-found: error
3939

4040
- name: upload httpd.conf artifact
41-
uses: actions/upload-artifact@v4
41+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4242
with:
4343
name: httpd.conf
4444
path: _drafts/staging/httpd.conf

.github/workflows/on_call_staging_test.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@v4
1010
- name: Fetch site artifact
11-
uses: actions/download-artifact@v4.1.8
11+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
1212
with:
1313
name: _site
1414
- name: extract site artifact

.github/workflows/on_pr_lint.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: "On PR Lint"
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check_dependabot:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout source code
13+
uses: actions/checkout@v4
14+
15+
- name: Check Changes
16+
id: changed-env
17+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
18+
with:
19+
files: |
20+
.github/dependabot.yml
21+
22+
- if: |
23+
steps.changed-env.outputs.any_modified == 'true'
24+
run: |
25+
npx -y @bugron/validate-dependabot-yaml@latest
26+
27+
lint_cupcake:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout source code
31+
uses: actions/checkout@v4
32+
33+
- name: Lint Code Base
34+
continue-on-error: true
35+
uses: oxsecurity/megalinter/flavors/[email protected]
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/on_pr_test.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ jobs:
1111
staging_test:
1212
uses: ./.github/workflows/on_call_staging_test.yaml
1313
needs: build_site
14-

0 commit comments

Comments
 (0)