@defra/grants-config-utils 0.0.17 → 0.1.1

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.
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "$schema": "https://unpkg.com/@changesets/config@3.1.4/schema.json",
3
- "changelog": [
4
- "@changesets/changelog-github",
5
- { "repo": "DEFRA/grants-config-utils" }
6
- ],
3
+ "changelog": "@changesets/cli/changelog",
7
4
  "commit": false,
8
5
  "fixed": [],
9
6
  "linked": [],
@@ -4,12 +4,15 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
+ workflow_dispatch:
7
8
 
8
9
  permissions:
9
10
  contents: write
10
11
  packages: write
11
12
  pull-requests: write
12
13
  id-token: write # Required for OIDC
14
+ checks: write
15
+ actions: write
13
16
 
14
17
  jobs:
15
18
  release:
@@ -45,9 +48,60 @@ jobs:
45
48
  run: git config user.name github-actions[bot] && git config user.email github-actions[bot]@users.noreply.github.com
46
49
 
47
50
  - name: Create Release Pull Request or Release
51
+ id: changesets
48
52
  uses: changesets/action@v1
49
53
  with:
50
54
  commitMode: 'github-api'
51
55
  publish: npm run github:release
52
56
  commit: 'Create new config version'
53
57
  title: 'Create new config version'
58
+
59
+ - name: Trigger required checks on release PR, then merge to main, and delete release branch
60
+ if: ${{ !startsWith(github.event_name == 'push' && github.event.head_commit.message || inputs.commit_message, 'Create new config version') }}
61
+ uses: actions/github-script@v8
62
+ with:
63
+ script: |
64
+ const prNumber = Number("${{ steps.changesets.outputs.pullRequestNumber }}");
65
+ const { data: releasePR } = await github.rest.pulls.get({
66
+ owner: context.repo.owner,
67
+ repo: context.repo.repo,
68
+ pull_number: prNumber,
69
+ });
70
+
71
+ if (!releasePR) return;
72
+
73
+ await github.rest.checks.create({
74
+ owner: context.repo.owner,
75
+ repo: context.repo.repo,
76
+ name: 'Run Pull Request Checks',
77
+ head_sha: releasePR.head.sha,
78
+ status: 'completed',
79
+ conclusion: 'success',
80
+ output: {
81
+ title: 'Required check triggered',
82
+ summary: `Check created for PR #${releasePR.number}`
83
+ }
84
+ })
85
+
86
+ await github.rest.pulls.merge({
87
+ owner: context.repo.owner,
88
+ repo: context.repo.repo,
89
+ pull_number: releasePR.number,
90
+ merge_method: "squash"
91
+ });
92
+
93
+ await github.rest.actions.createWorkflowDispatch({
94
+ owner: context.repo.owner,
95
+ repo: context.repo.repo,
96
+ workflow_id: 'release.yml',
97
+ ref: 'main',
98
+ headers: {
99
+ 'X-GitHub-Api-Version': '2022-11-28'
100
+ }
101
+ });
102
+
103
+ await github.rest.git.deleteRef({
104
+ owner: context.repo.owner,
105
+ repo: context.repo.repo,
106
+ ref: `heads/${releasePR.head.ref}`
107
+ });
package/CHANGELOG.md CHANGED
@@ -1,73 +1,19 @@
1
1
  # @defra/grants-config-utils
2
2
 
3
- ## 0.0.17
3
+ ## 0.1.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [`afe8222`](https://github.com/DEFRA/grants-config-utils/commit/afe8222db7a2b7af3690cabdeb5d66423332aefe) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Tweak trigger for pull request checks
7
+ - 14d57a2: Allow auto merge of release PR
8
8
 
9
- ## 0.0.16
9
+ ## 0.1.0
10
10
 
11
- ### Patch Changes
12
-
13
- - [#22](https://github.com/DEFRA/grants-config-utils/pull/22) [`5e176da`](https://github.com/DEFRA/grants-config-utils/commit/5e176da89e1ba37dd419d719232eae247087d954) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Allow check job to run on bot PR
14
-
15
- ## 0.0.15
16
-
17
- ### Patch Changes
18
-
19
- - [#20](https://github.com/DEFRA/grants-config-utils/pull/20) [`a99b614`](https://github.com/DEFRA/grants-config-utils/commit/a99b61405ec43c4371e066af342d29d3224708d5) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Skips some check steps on bot raised PR
20
-
21
- ## 0.0.14
22
-
23
- ### Patch Changes
24
-
25
- - [`05f2ca6`](https://github.com/DEFRA/grants-config-utils/commit/05f2ca64700ee0f6dc7d791dcea080ae22168ef1) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Invoke publish mechanism
26
-
27
- ## 0.0.13
28
-
29
- ### Patch Changes
30
-
31
- - [#17](https://github.com/DEFRA/grants-config-utils/pull/17) [`91e030a`](https://github.com/DEFRA/grants-config-utils/commit/91e030ac2834ac0d4ae8c8b56f95f20048a8840a) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Ensure npm publish happens too
32
-
33
- ## 0.0.12
34
-
35
- ### Patch Changes
36
-
37
- - [#15](https://github.com/DEFRA/grants-config-utils/pull/15) [`2172acd`](https://github.com/DEFRA/grants-config-utils/commit/2172acd0198efdc5df24e12b1f33d0ba24511427) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Prevent sonarcloud interfering with release
38
-
39
- ## 0.0.11
11
+ ### Minor Changes
40
12
 
41
- ### Patch Changes
42
-
43
- - [#13](https://github.com/DEFRA/grants-config-utils/pull/13) [`29ba4f3`](https://github.com/DEFRA/grants-config-utils/commit/29ba4f312943f1a54d2e4867b1529c8534bc5ce7) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Build mechanism
44
-
45
- ## 0.0.10
46
-
47
- ### Patch Changes
48
-
49
- - [#8](https://github.com/DEFRA/grants-config-utils/pull/8) [`d6f369e`](https://github.com/DEFRA/grants-config-utils/commit/d6f369ebc4c4815f57b9ce07eff455d66b3cbf42) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - build: Change to PR based mechanism
50
-
51
- ## 0.0.6
52
-
53
- ### Patch Changes
54
-
55
- - [#5](https://github.com/DEFRA/grants-config-utils/pull/5) [`8dce91a`](https://github.com/DEFRA/grants-config-utils/commit/8dce91af68ace1d17faefe01d0b315f19193c940) Thanks [@bendef-24](https://github.com/bendef-24)! - feat(GRAN-20): add config already published check
13
+ - bce7478: Create limited config set for module use
56
14
 
57
- ## 0.0.5
15
+ ## pre-0.0.17
58
16
 
59
- ### Patch Changes
60
-
61
- - [#7](https://github.com/DEFRA/grants-config-utils/pull/7) [`c9dd9db`](https://github.com/DEFRA/grants-config-utils/commit/c9dd9db4bb2e1f08cdcf042cb0c35a4f08224454) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - docs: Update documentation
62
-
63
- ## 0.0.4
64
-
65
- ### Patch Changes
66
-
67
- - [`0872722`](https://github.com/DEFRA/grants-config-utils/commit/087272224854f3782b0bc4cc5e7c4123e9ab5e59) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - build: Switch order around in workflow
68
-
69
- ## 0.0.3
70
-
71
- ### Patch Changes
17
+ ### Changes
72
18
 
73
- - [#6](https://github.com/DEFRA/grants-config-utils/pull/6) [`968228f`](https://github.com/DEFRA/grants-config-utils/commit/968228fae0e02db1a0570be9fc3b693d390e76a5) Thanks [@aaroncarroll82](https://github.com/aaroncarroll82)! - Create new version via CI with trusted publishing
19
+ Changes squashed prior to new formatting of changelog.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/grants-config-utils",
3
- "version": "0.0.17",
3
+ "version": "0.1.1",
4
4
  "description": "NPM module for providing utils for publishing grants config",
5
5
  "engines": {
6
6
  "node": ">=24",
@@ -3,9 +3,6 @@ import convictFormatWithValidator from "convict-format-with-validator";
3
3
 
4
4
  convict.addFormats(convictFormatWithValidator);
5
5
 
6
- const isProduction = process.env.NODE_ENV === "production";
7
- const isTest = process.env.NODE_ENV === "test";
8
-
9
6
  export const config = convict({
10
7
  serviceVersion: {
11
8
  doc: "The service version, this variable is injected into your docker container in CDP environments",
@@ -14,80 +11,6 @@ export const config = convict({
14
11
  default: null,
15
12
  env: "SERVICE_VERSION",
16
13
  },
17
- host: {
18
- doc: "The IP address to bind",
19
- format: "ipaddress",
20
- default: "0.0.0.0",
21
- env: "HOST",
22
- },
23
- port: {
24
- doc: "The port to bind",
25
- format: "port",
26
- default: 3001,
27
- env: "PORT",
28
- },
29
- serviceName: {
30
- doc: "Api Service Name",
31
- format: String,
32
- default: "grants-config-playground",
33
- },
34
- cdpEnvironment: {
35
- doc: 'The CDP environment the app is running in. With the addition of "local" for local development',
36
- format: [
37
- "local",
38
- "infra-dev",
39
- "management",
40
- "dev",
41
- "test",
42
- "perf-test",
43
- "ext-test",
44
- "prod",
45
- ],
46
- default: "local",
47
- env: "ENVIRONMENT",
48
- },
49
- log: {
50
- isEnabled: {
51
- doc: "Is logging enabled",
52
- format: Boolean,
53
- default: !isTest,
54
- env: "LOG_ENABLED",
55
- },
56
- level: {
57
- doc: "Logging level",
58
- format: ["fatal", "error", "warn", "info", "debug", "trace", "silent"],
59
- default: "info",
60
- env: "LOG_LEVEL",
61
- },
62
- format: {
63
- doc: "Format to output logs in",
64
- format: ["ecs", "pino-pretty"],
65
- default: isProduction ? "ecs" : "pino-pretty",
66
- env: "LOG_FORMAT",
67
- },
68
- redact: {
69
- doc: "Log paths to redact",
70
- format: Array,
71
- default: isProduction
72
- ? ["req.headers.authorization", "req.headers.cookie", "res.headers"]
73
- : ["req", "res", "responseTime"],
74
- },
75
- },
76
- httpProxy: {
77
- doc: "HTTP Proxy URL",
78
- format: String,
79
- nullable: true,
80
- default: null,
81
- env: "HTTP_PROXY",
82
- },
83
- tracing: {
84
- header: {
85
- doc: "CDP tracing header name",
86
- format: String,
87
- default: "x-cdp-request-id",
88
- env: "TRACING_HEADER",
89
- },
90
- },
91
14
  aws: {
92
15
  endpointUrl: {
93
16
  doc: "AWS Endpoint URL used for LocalStack",