node-package-release-action 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -73,6 +73,10 @@ This controls whether the GitHub Release should be marked as a prerelease. The d
73
73
 
74
74
  The controls whether this action should do nothing if there's no changes since last release of the same release type. If we release a minor upgrade to `1.2.3` or `1.2.3-4` it should be `1.2.4`. If `1.2.4` and `1.2.3` are the same and if `skip-if-no-diff` is set to `true`, `1.2.4` won't be created. `1.2.3-*` won't be used in the comparison. The default value is `false`.
75
75
 
76
+ ### `diff-targets`
77
+
78
+ This controls the diff targets used with `skip-if-no-diff`. The default value is `"."`. For example, it could be `"{package.json,lib/**/*}"` for a typical TypeScript project with compiled files in the `lib` directory. Use glob pattern to match multiple directories if necessary, for example `"{src,lib}"` instead of `"src lib"` or `"{src, lib}"` to match both the `src` directory and the `lib` directory.
79
+
76
80
  ### `dry-run`
77
81
 
78
82
  This controls whether this is a dry run. The default value is `false`. It's used for debugging only.
package/lib/checkDiff.js CHANGED
@@ -10,11 +10,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.checkDiff = void 0;
13
+ const node_path_1 = require("node:path");
13
14
  const core_1 = require("@actions/core");
14
15
  const exec_1 = require("@actions/exec");
16
+ const glob_1 = require("@actions/glob");
15
17
  function checkDiff(tag) {
16
18
  return __awaiter(this, void 0, void 0, function* () {
17
- const diffOutput = yield (0, exec_1.getExecOutput)("git", ["diff", tag, "--name-only"]);
19
+ const directory = (0, core_1.getInput)("directory");
20
+ const diffTargets = (0, core_1.getInput)("diff-targets");
21
+ const globber = yield (0, glob_1.create)((0, node_path_1.join)(directory, diffTargets));
22
+ const glob = yield globber.glob();
23
+ const diffOutput = yield (0, exec_1.getExecOutput)("git", [
24
+ "diff",
25
+ tag,
26
+ "--name-only",
27
+ "--",
28
+ ...glob,
29
+ ]);
18
30
  if (diffOutput.exitCode !== core_1.ExitCode.Success) {
19
31
  throw new Error(diffOutput.stderr);
20
32
  }
@@ -1,3 +1,3 @@
1
1
  import type { Octokit } from "@octokit/core";
2
2
  import type { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
3
- export declare function getlatestReleaseTag(owner: string, repo: string, octokit: Octokit & Api): Promise<string | null>;
3
+ export declare function getLatestReleaseTag(owner: string, repo: string, octokit: Octokit & Api): Promise<string | null>;
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getlatestReleaseTag = void 0;
12
+ exports.getLatestReleaseTag = void 0;
13
13
  const core_1 = require("@actions/core");
14
14
  const request_error_1 = require("@octokit/request-error");
15
15
  const semver_1 = require("semver");
16
- function getlatestReleaseTag(owner, repo, octokit) {
16
+ function getLatestReleaseTag(owner, repo, octokit) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  try {
19
19
  const latestReleaseResponse = yield octokit.rest.repos.getLatestRelease({
@@ -61,4 +61,4 @@ function getlatestReleaseTag(owner, repo, octokit) {
61
61
  return sortedReleaseTags[0];
62
62
  });
63
63
  }
64
- exports.getlatestReleaseTag = getlatestReleaseTag;
64
+ exports.getLatestReleaseTag = getLatestReleaseTag;
package/lib/index.js CHANGED
@@ -18,7 +18,7 @@ const configGit_1 = require("./configGit");
18
18
  const fetchEverything_1 = require("./fetchEverything");
19
19
  const getLastGitTag_1 = require("./getLastGitTag");
20
20
  const getPackageVersion_1 = require("./getPackageVersion");
21
- const getlatestReleaseTag_1 = require("./getlatestReleaseTag");
21
+ const getLatestReleaseTag_1 = require("./getLatestReleaseTag");
22
22
  const findLastSameReleaseTypeVersion_1 = require("./findLastSameReleaseTypeVersion");
23
23
  const setVersion_1 = require("./setVersion");
24
24
  const pushBranch_1 = require("./pushBranch");
@@ -36,7 +36,7 @@ function run() {
36
36
  (0, core_1.notice)(`package.json version: ${packageVersion}`);
37
37
  const { owner, repo } = github_1.context.repo;
38
38
  const octokit = (0, getOctokit_1.getOctokit)();
39
- const latestReleaseTag = yield (0, getlatestReleaseTag_1.getlatestReleaseTag)(owner, repo, octokit);
39
+ const latestReleaseTag = yield (0, getLatestReleaseTag_1.getLatestReleaseTag)(owner, repo, octokit);
40
40
  (0, core_1.notice)(`Latest release tag: ${latestReleaseTag}`);
41
41
  const versions = [lastGitTag, packageVersion, latestReleaseTag].flatMap((version) => (version === null ? [] : [version]));
42
42
  const sortedVersions = (0, semver_1.rsort)(versions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-package-release-action",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "A template to create custom GitHub Action with TypeScript/JavaScript.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.js",
@@ -42,6 +42,7 @@
42
42
  "@actions/core": "^1.10.0",
43
43
  "@actions/exec": "^1.1.1",
44
44
  "@actions/github": "^5.1.1",
45
+ "@actions/glob": "^0.3.0",
45
46
  "@octokit/plugin-retry": "^4.0.3",
46
47
  "@octokit/plugin-throttling": "^4.3.2",
47
48
  "semver": "^7.3.8"