Compare commits

...

4 Commits

Author SHA1 Message Date
Sukka
f1fec09d07
Merge 2504c6551f into 13427813f7 2025-10-08 08:27:38 -07:00
dependabot[bot]
13427813f7
Bump actions/publish-action from 0.3.0 to 0.4.0 (#1362)
Bumps [actions/publish-action](https://github.com/actions/publish-action) from 0.3.0 to 0.4.0.
- [Commits](https://github.com/actions/publish-action/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: actions/publish-action
  dependency-version: 0.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-08 09:32:50 -05:00
Sukka
2504c6551f
fix typo by github copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-11 01:31:08 +08:00
SukkaW
a7ea957cac refactor: minor changes follows #1348
- Only enable package cache when the cache feature is availiable
- We don't read "package.json" if previous version "cache" field is used
2025-09-11 01:27:24 +08:00
2 changed files with 20 additions and 13 deletions

View File

@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.3.0
uses: actions/publish-action@v0.4.0
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@ -67,19 +67,26 @@ export async function run() {
auth.configAuthentication(registryUrl, alwaysAuth);
}
const resolvedPackageManager = getNameFromPackageManagerField();
const cacheDependencyPath = core.getInput('cache-dependency-path');
if (cache && isCacheFeatureAvailable()) {
core.saveState(State.CachePackageManager, cache);
await restoreCache(cache, cacheDependencyPath);
} else if (resolvedPackageManager && packagemanagercache) {
core.info(
"Detected package manager from package.json's packageManager field: " +
resolvedPackageManager +
'. Auto caching has been enabled for it. If you want to disable it, set package-manager-cache input to false'
);
core.saveState(State.CachePackageManager, resolvedPackageManager);
await restoreCache(resolvedPackageManager, cacheDependencyPath);
if (isCacheFeatureAvailable()) {
// we only determine the package manager type if we can cache in the first place
if (cache) {
// in previous version of setup-node, user can explicitly specify what package manager they are using, we prefer that
core.saveState(State.CachePackageManager, cache);
await restoreCache(cache, cacheDependencyPath);
} else if (packagemanagercache) {
// only if user hasn't specify the "cache" (introduced in the previous version) we read the "package-manager-cache" field
const resolvedPackageManager = getNameFromPackageManagerField(); // only then we look for "package.json" for package manager
if (resolvedPackageManager) {
core.info(
"Detected package manager from package.json's packageManager field: " +
resolvedPackageManager +
'. Auto caching has been enabled for it. If you want to disable it, set package-manager-cache input to false'
);
core.saveState(State.CachePackageManager, resolvedPackageManager);
await restoreCache(resolvedPackageManager, cacheDependencyPath);
}
}
}
const matchersPath = path.join(__dirname, '../..', '.github');