Compare commits

..

1 Commits

Author SHA1 Message Date
peaceiris 9b7aa41d20 ci: harden GitHub Actions workflows
Pin workflow actions to commit SHAs, set explicit permissions and timeouts, update Ubuntu runners, and include the generated action bundle.

Co-Authored-By: Codex <noreply@openai.com>
2026-05-10 01:18:21 +09:00
17 changed files with 97 additions and 137 deletions
+7 -6
View File
@@ -6,23 +6,24 @@ on:
- main
pull_request:
permissions:
security-events: write
contents: read
jobs:
CodeQL-Build:
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Initialize CodeQL
uses: github/codeql-action/init@7fd177fa680c9881b53cdab4d346d32574c9f7f4 # v3.35.4
uses: github/codeql-action/init@1521896cd211af95be3f02edf6f436e10b819c27 # v3.35.4
with:
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@7fd177fa680c9881b53cdab4d346d32574c9f7f4 # v3.35.4
uses: github/codeql-action/autobuild@1521896cd211af95be3f02edf6f436e10b819c27 # v3.35.4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@7fd177fa680c9881b53cdab4d346d32574c9f7f4 # v3.35.4
uses: github/codeql-action/analyze@1521896cd211af95be3f02edf6f436e10b819c27 # v3.35.4
+1 -1
View File
@@ -11,7 +11,7 @@ permissions:
jobs:
dependency-review:
runs-on: ubuntu-24.04
timeout-minutes: 5
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0
+4 -3
View File
@@ -21,12 +21,13 @@ on:
- 'Dockerfile'
- 'Makefile'
permissions:
contents: read
jobs:
dev-image-test:
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: read
timeout-minutes: 30
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- run: make build
+6 -5
View File
@@ -10,20 +10,21 @@ on:
# - labeled
# - unlabeled
permissions:
contents: read
issues: write
jobs:
comment:
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
issues: write
timeout-minutes: 10
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: main
- name: Label Commenter
uses: peaceiris/actions-label-commenter@f0dbbef043eb1b150b566db36b0bdc8b7f505579 # v1.10.0
uses: peaceiris/actions-label-commenter@c74c602750041f04c2bb68d200fc2fdae169a044 # v1.10.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# config_file: .github/label-commenter-config.yml
@@ -4,14 +4,16 @@ on:
schedule:
- cron: '4 18 * * */7'
permissions: {}
jobs:
purge:
runs-on: ubuntu-slim
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions: {}
steps:
- run: |
- name: Purge README image cache
run: >
curl -sL "https://github.com/${GITHUB_REPOSITORY}" |
grep -oE '<img src="https?://camo.githubusercontent.com/[^"]+' |
sed -e 's/<img src="//' |
xargs -r -I % curl -sX PURGE %
xargs -I % curl -sX PURGE %
+6 -15
View File
@@ -5,25 +5,16 @@ on:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}"
- name: Install github/hub
run: |
export HUB_VERSION="2.14.2"
curl -fsSL https://github.com/github/hub/raw/8d91904208171b013f9a9d1175f4ab39068db047/script/get | bash -s "${HUB_VERSION}"
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -32,8 +23,8 @@ jobs:
echo "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG_NAME}/CHANGELOG.md) for more details." > ./release_notes.md
RELEASE_NAME="$(jq -r '.name' ./package.json)"
sed -i "1i${RELEASE_NAME} ${TAG_NAME}\n" ./release_notes.md
./bin/hub release create \
gh release create "${TAG_NAME}" \
--draft \
--prerelease \
--file ./release_notes.md \
"${TAG_NAME}"
--notes-file ./release_notes.md \
--title "${RELEASE_NAME} ${TAG_NAME}"
+14 -4
View File
@@ -6,12 +6,13 @@ on:
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
timeout-minutes: 20
strategy:
matrix:
hugo-version: ['latest', '0.160.1']
@@ -19,8 +20,17 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
uses: ./
with:
hugo-version: ${{ matrix.hugo-version }}
extended: ${{ matrix.extended }}
+5 -4
View File
@@ -10,12 +10,13 @@ on:
paths-ignore:
- '**.md'
permissions:
contents: read
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 20
permissions:
contents: read
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
@@ -53,4 +54,4 @@ jobs:
name: coverage-${{ matrix.os }}
path: coverage
- uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
- uses: codecov/codecov-action@aa56896cf108bd10b5eb883cd1d24196da57f695 # v5.5.4
+3 -3
View File
@@ -4,12 +4,13 @@ on:
release:
types: [released]
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
@@ -17,7 +18,6 @@ jobs:
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
export TAG_NAME="${GITHUB_REF##refs/tags/}"
export TAG_MAJOR="${TAG_NAME%%.*}"
git tag --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
-1
View File
@@ -4,4 +4,3 @@ coverage
.eslintcache
.env
node_modules
.codex/
+1 -1
View File
@@ -1 +1 @@
24.15.0
20.11.1
-29
View File
@@ -2,35 +2,6 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
# [3.1.0](https://github.com/peaceiris/actions-hugo/compare/v3.0.0...v3.1.0) (2026-05-10)
### chore
* add .codex/ ([fd1a667](https://github.com/peaceiris/actions-hugo/commit/fd1a6670898ca2ebf1a2c7f921f3eaf59eb75878))
### ci
* bump actions/dependency-review-action from 3 to 4 (#656) ([711df4e](https://github.com/peaceiris/actions-hugo/commit/711df4ed6415b013fd3ce424f98c5720d36d19e0)), closes [#656](https://github.com/peaceiris/actions-hugo/issues/656)
* bump actions/upload-artifact from 3 to 4 (#654) ([764796d](https://github.com/peaceiris/actions-hugo/commit/764796d276c5a0094764d3fb3fbc3bb6fefb19e6)), closes [#654](https://github.com/peaceiris/actions-hugo/issues/654)
* bump codecov/codecov-action from 3 to 4 (#655) ([e177dc3](https://github.com/peaceiris/actions-hugo/commit/e177dc33cb0d5866aa77a82d4cdfdda3a5cd76a3)), closes [#655](https://github.com/peaceiris/actions-hugo/issues/655)
* bump codecov/codecov-action from 4 to 5 (#660) ([3a28794](https://github.com/peaceiris/actions-hugo/commit/3a287949d38134f0920e6ac20032acef6d4a23c4)), closes [#660](https://github.com/peaceiris/actions-hugo/issues/660)
* bump github/codeql-action from 2 to 3 (#657) ([9d57878](https://github.com/peaceiris/actions-hugo/commit/9d57878417d5429540d059b1dbf19e0717797912)), closes [#657](https://github.com/peaceiris/actions-hugo/issues/657)
* bump peaceiris/actions-hugo from 2.6.0 to 3.0.0 (#653) ([3b44307](https://github.com/peaceiris/actions-hugo/commit/3b443076f02aa9537a31bdcaa0c971cdd41eb022)), closes [#653](https://github.com/peaceiris/actions-hugo/issues/653)
* harden workflows and update Node.js (#686) ([64e0f66](https://github.com/peaceiris/actions-hugo/commit/64e0f66acbd8b134359e19b06e518ceb2734de14)), closes [#686](https://github.com/peaceiris/actions-hugo/issues/686)
### docs
* add contributor guidelines ([ba5146c](https://github.com/peaceiris/actions-hugo/commit/ba5146cb8a90074a91c351b17a4206ffd8594cd5))
* add env.HUGO_CACHEDIR (#650) ([288264f](https://github.com/peaceiris/actions-hugo/commit/288264f9c9c4a54b634fdbfdc119faefe699d549)), closes [#650](https://github.com/peaceiris/actions-hugo/issues/650)
* bump actions/cache to v4 ([7db63f5](https://github.com/peaceiris/actions-hugo/commit/7db63f5e7f65f5c06a64fd56106389606f84a976))
### feat
* upgrade action runtime from Node 20 to 24 (#684) ([83259d8](https://github.com/peaceiris/actions-hugo/commit/83259d800c0f56b05d14cb0b320d8e4034770d68)), closes [#684](https://github.com/peaceiris/actions-hugo/issues/684)
# [3.0.0](https://github.com/peaceiris/actions-hugo/compare/v2.6.0...v3.0.0) (2024-04-02)
+2 -2
View File
@@ -1,6 +1,6 @@
ARG NODE_VERSION=24.15.0
ARG NODE_VERSION
FROM node:${NODE_VERSION}-bookworm-slim
FROM node:${NODE_VERSION}-buster-slim
SHELL ["/bin/bash", "-l", "-c"]
+10 -23
View File
@@ -11224,7 +11224,7 @@ function getURL(org, repo, api) {
exports.getURL = getURL;
async function getLatestVersion(org, repo, api) {
const url = getURL(org, repo, api);
const response = await (0, node_fetch_1.default)(url);
const response = await node_fetch_1.default(url);
const json = await response.json();
let latestVersion = '';
if (api === 'brew') {
@@ -11303,11 +11303,7 @@ exports["default"] = getURL;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -11332,8 +11328,7 @@ const main = __importStar(__nccwpck_require__(399));
await main.run();
}
catch (e) {
const message = e instanceof Error ? e.message : String(e);
core.setFailed(`Action failed with error ${message}`);
core.setFailed(`Action failed with error ${e.message}`);
}
})();
@@ -11347,11 +11342,7 @@ const main = __importStar(__nccwpck_require__(399));
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -11418,11 +11409,11 @@ exports.createBinDir = createBinDir;
async function installer(version) {
const extended = core.getInput('extended');
core.debug(`Hugo extended: ${extended}`);
const osName = (0, get_os_1.default)(process.platform);
const osName = get_os_1.default(process.platform);
core.debug(`Operating System: ${osName}`);
const archName = (0, get_arch_1.default)(process.arch);
const archName = get_arch_1.default(process.arch);
core.debug(`Processor Architecture: ${archName}`);
const toolURL = (0, get_url_1.default)(osName, archName, extended, version);
const toolURL = get_url_1.default(osName, archName, extended, version);
core.debug(`toolURL: ${toolURL}`);
const workDir = await createWorkDir();
const binDir = await createBinDir(workDir);
@@ -11451,11 +11442,7 @@ exports.installer = installer;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
@@ -11506,13 +11493,13 @@ async function run() {
output: ''
};
if (toolVersion === '' || toolVersion === 'latest') {
installVersion = await (0, get_latest_version_1.getLatestVersion)(constants_1.Tool.Org, constants_1.Tool.Repo, 'brew');
installVersion = await get_latest_version_1.getLatestVersion(constants_1.Tool.Org, constants_1.Tool.Repo, 'brew');
}
else {
installVersion = toolVersion;
}
core.info(`${constants_1.Tool.Name} version: ${installVersion}`);
await (0, installer_1.installer)(installVersion);
await installer_1.installer(installVersion);
result = await showVersion(constants_1.Tool.CmdName, [constants_1.Tool.CmdOptVersion]);
return result;
}
+26 -29
View File
@@ -1,6 +1,6 @@
{
"name": "actions-hugo",
"version": "3.1.0",
"version": "3.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
@@ -18,7 +18,7 @@
},
"devDependencies": {
"@types/jest": "^26.0.20",
"@types/node": "~24",
"@types/node": "~20",
"@types/node-fetch": "^2.5.8",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
@@ -33,11 +33,11 @@
"prettier": "2.2.1",
"standard-version": "^9.1.1",
"ts-jest": "^26.5.3",
"typescript": "^4.9.5"
"typescript": "^4.2.3"
},
"engines": {
"node": ">=24.15.0",
"npm": ">=11.12.1"
"node": ">=20.10.0",
"npm": ">=10.2.3"
}
},
"node_modules/@actions/core": {
@@ -1740,13 +1740,12 @@
"dev": true
},
"node_modules/@types/node": {
"version": "24.12.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.2.tgz",
"integrity": "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==",
"version": "20.10.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz",
"integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.16.0"
"undici-types": "~5.26.4"
}
},
"node_modules/@types/node-fetch": {
@@ -11914,11 +11913,10 @@
}
},
"node_modules/typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -11941,11 +11939,10 @@
}
},
"node_modules/undici-types": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"dev": true,
"license": "MIT"
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
},
"node_modules/union-value": {
"version": "1.0.1",
@@ -13900,12 +13897,12 @@
"dev": true
},
"@types/node": {
"version": "24.12.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.2.tgz",
"integrity": "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==",
"version": "20.10.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz",
"integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==",
"dev": true,
"requires": {
"undici-types": "~7.16.0"
"undici-types": "~5.26.4"
}
},
"@types/node-fetch": {
@@ -21900,9 +21897,9 @@
}
},
"typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz",
"integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==",
"dev": true
},
"uglify-js": {
@@ -21913,9 +21910,9 @@
"optional": true
},
"undici-types": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
},
"union-value": {
+5 -5
View File
@@ -1,11 +1,11 @@
{
"name": "actions-hugo",
"version": "3.1.0",
"version": "3.0.0",
"description": "GitHub Actions for Hugo",
"main": "lib/index.js",
"engines": {
"node": ">=24.15.0",
"npm": ">=11.12.1"
"node": ">=20.10.0",
"npm": ">=10.2.3"
},
"scripts": {
"all": "npm run format:check && npm run lint && npm test",
@@ -55,7 +55,7 @@
},
"devDependencies": {
"@types/jest": "^26.0.20",
"@types/node": "~24",
"@types/node": "~20",
"@types/node-fetch": "^2.5.8",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
@@ -70,6 +70,6 @@
"prettier": "2.2.1",
"standard-version": "^9.1.1",
"ts-jest": "^26.5.3",
"typescript": "^4.9.5"
"typescript": "^4.2.3"
}
}
+1 -2
View File
@@ -5,7 +5,6 @@ import * as main from './main';
try {
await main.run();
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
core.setFailed(`Action failed with error ${message}`);
core.setFailed(`Action failed with error ${e.message}`);
}
})();