@sapphire-sh/utils 2.12.0 → 2.14.0

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.
@@ -82,6 +82,9 @@ const writeSectioned = (outputName, content) => {
82
82
  console.log(`wrote ${outputName}`);
83
83
  };
84
84
 
85
+ const formatYamlValue = (value) =>
86
+ typeof value === 'string' && value.includes("'") === false ? `'${value}'` : JSON.stringify(value);
87
+
85
88
  const writeWorkflow = (outputName, template) => {
86
89
  const filepath = join(cwd, outputName);
87
90
  const values = workflowValues[basename(outputName, '.yml')];
@@ -95,7 +98,7 @@ const writeWorkflow = (outputName, template) => {
95
98
  const { 'paths-ignore': pathsIgnore, ...withValues } = values;
96
99
 
97
100
  if (pathsIgnore !== undefined) {
98
- const pathsIgnoreLines = pathsIgnore.map((value) => ` - ${JSON.stringify(value)}\n`).join('');
101
+ const pathsIgnoreLines = pathsIgnore.map((value) => ` - ${formatYamlValue(value)}\n`).join('');
99
102
  content = content.replace(
100
103
  branchesListPattern,
101
104
  (branchesList) => `${branchesList} paths-ignore:\n${pathsIgnoreLines}`,
@@ -107,7 +110,7 @@ const writeWorkflow = (outputName, template) => {
107
110
  }
108
111
 
109
112
  for (const [key, value] of Object.entries(withValues)) {
110
- content += ` ${key}: ${JSON.stringify(value)}\n`;
113
+ content += ` ${key}: ${formatYamlValue(value)}\n`;
111
114
  }
112
115
  }
113
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire-sh/utils",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "description": "@sapphire-sh/utils",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -4,6 +4,7 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
+ pull_request:
7
8
 
8
9
  concurrency:
9
10
  group: ${{ github.workflow }}-${{ github.ref }}
@@ -12,3 +12,5 @@ jobs:
12
12
  contents: write
13
13
  issues: write
14
14
  pull-requests: write
15
+ secrets:
16
+ PULL_REQUEST_TOKEN: ${{ secrets.PULL_REQUEST_TOKEN }}
@@ -15,3 +15,5 @@ jobs:
15
15
  contents: write
16
16
  issues: write
17
17
  pull-requests: write
18
+ secrets:
19
+ PULL_REQUEST_TOKEN: ${{ secrets.PULL_REQUEST_TOKEN }}