Skip to content

Commit f4c8adb

Browse files
committed
remove code duplication
1 parent 433a5b9 commit f4c8adb

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

actions/release-tag-creation/action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,17 @@ runs:
3838
steps:
3939
- name: Install dependencies
4040
shell: bash
41-
run: npm install --prefix "${{ github.action_path }}"
41+
env:
42+
ACTION_PATH: ${{ github.action_path }}
43+
run: npm install --prefix "$ACTION_PATH"
4244

4345
- name: Handle version input
4446
id: handle-version-input
4547
shell: bash
4648
env:
4749
INPUT_VERSION: ${{ inputs.version }}
48-
run: node "${{ github.action_path }}/main.ts"
50+
ACTION_PATH: ${{ github.action_path }}
51+
run: node "$ACTION_PATH/main.ts"
4952

5053
- name: Switch to release branch
5154
shell: bash
@@ -72,7 +75,8 @@ runs:
7275
INPUT_VERSION: ${{ inputs.version }}
7376
INPUT_CHANNEL: ${{ steps.handle-version-input.outputs.channel }}
7477
INPUT_COMPANION_TAG: ${{ steps.handle-version-input.outputs.companion_tag }}
75-
run: node "${{ github.action_path }}/update-version-files.ts"
78+
ACTION_PATH: ${{ github.action_path }}
79+
run: node "$ACTION_PATH/update-version-files.ts"
7680

7781
- name: Commit version bump
7882
shell: bash

actions/release-tag-creation/main.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { spawnSync } from 'node:child_process';
22
import { appendFileSync } from 'node:fs';
3-
import semver from 'semver';
4-
import { checkVersionIsNext, fetchCompanionTag } from './current-version-validation.ts';
3+
import semver from 'semver';
4+
import { checkVersionIsNext, fetchCompanionTag } from './current-version-validation.ts';
55

66
// X.Y.Z or X.Y.Z-betaN — no dot between "beta" and the number
77
export const ALLOWED_PATTERN = /^\d+\.\d+\.\d+(-beta\d+)?$/;
@@ -63,9 +63,6 @@ export function checkCurrentTagDoesNotExist(version: string): void {
6363
console.log(`✅ Version ${version} does not exist as a GitHub Release.`);
6464
}
6565

66-
67-
68-
6966
// ─── derivation ───────────────────────────────────────────────────────────────
7067

7168
export function extractChannel(version: string): 'stable' | 'beta' {

0 commit comments

Comments
 (0)