@defra/grants-config-utils 0.1.0 → 0.1.2
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/.github/workflows/release.yml +62 -0
- package/CHANGELOG.md +12 -0
- package/CONTRIBUTING.md +2 -3
- package/README.md +13 -0
- package/package.json +1 -1
|
@@ -4,12 +4,20 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
commit_message:
|
|
10
|
+
description: 'commit message'
|
|
11
|
+
required: false
|
|
12
|
+
type: string
|
|
7
13
|
|
|
8
14
|
permissions:
|
|
9
15
|
contents: write
|
|
10
16
|
packages: write
|
|
11
17
|
pull-requests: write
|
|
12
18
|
id-token: write # Required for OIDC
|
|
19
|
+
checks: write
|
|
20
|
+
actions: write
|
|
13
21
|
|
|
14
22
|
jobs:
|
|
15
23
|
release:
|
|
@@ -45,9 +53,63 @@ jobs:
|
|
|
45
53
|
run: git config user.name github-actions[bot] && git config user.email github-actions[bot]@users.noreply.github.com
|
|
46
54
|
|
|
47
55
|
- name: Create Release Pull Request or Release
|
|
56
|
+
id: changesets
|
|
48
57
|
uses: changesets/action@v1
|
|
49
58
|
with:
|
|
50
59
|
commitMode: 'github-api'
|
|
51
60
|
publish: npm run github:release
|
|
52
61
|
commit: 'Create new config version'
|
|
53
62
|
title: 'Create new config version'
|
|
63
|
+
|
|
64
|
+
- name: Trigger required checks on release PR, then merge to main, and delete release branch
|
|
65
|
+
if: ${{ !startsWith(github.event_name == 'push' && github.event.head_commit.message || inputs.commit_message, 'Create new config version') }}
|
|
66
|
+
uses: actions/github-script@v8
|
|
67
|
+
with:
|
|
68
|
+
script: |
|
|
69
|
+
const prNumber = Number("${{ steps.changesets.outputs.pullRequestNumber }}");
|
|
70
|
+
const { data: releasePR } = await github.rest.pulls.get({
|
|
71
|
+
owner: context.repo.owner,
|
|
72
|
+
repo: context.repo.repo,
|
|
73
|
+
pull_number: prNumber,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (!releasePR) return;
|
|
77
|
+
|
|
78
|
+
await github.rest.checks.create({
|
|
79
|
+
owner: context.repo.owner,
|
|
80
|
+
repo: context.repo.repo,
|
|
81
|
+
name: 'Run Pull Request Checks',
|
|
82
|
+
head_sha: releasePR.head.sha,
|
|
83
|
+
status: 'completed',
|
|
84
|
+
conclusion: 'success',
|
|
85
|
+
output: {
|
|
86
|
+
title: 'Required check triggered',
|
|
87
|
+
summary: `Check created for PR #${releasePR.number}`
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
await github.rest.pulls.merge({
|
|
92
|
+
owner: context.repo.owner,
|
|
93
|
+
repo: context.repo.repo,
|
|
94
|
+
pull_number: releasePR.number,
|
|
95
|
+
merge_method: "squash"
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await github.rest.actions.createWorkflowDispatch({
|
|
99
|
+
owner: context.repo.owner,
|
|
100
|
+
repo: context.repo.repo,
|
|
101
|
+
workflow_id: 'release.yml',
|
|
102
|
+
ref: 'main',
|
|
103
|
+
headers: {
|
|
104
|
+
'X-GitHub-Api-Version': '2022-11-28'
|
|
105
|
+
},
|
|
106
|
+
inputs: {
|
|
107
|
+
commit_message: 'Create new config version'
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
await github.rest.git.deleteRef({
|
|
112
|
+
owner: context.repo.owner,
|
|
113
|
+
repo: context.repo.repo,
|
|
114
|
+
ref: `heads/${releasePR.head.ref}`
|
|
115
|
+
});
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @defra/grants-config-utils
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c6fc2ef: fix: Skips auto merge stage on second run through
|
|
8
|
+
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 14d57a2: Allow auto merge of release PR
|
|
14
|
+
|
|
3
15
|
## 0.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/CONTRIBUTING.md
CHANGED
|
@@ -19,6 +19,5 @@ To make changes to this library, please follow the steps below:
|
|
|
19
19
|
4. Push to branch, and create a pull request.
|
|
20
20
|
5. Github actions will verify the build
|
|
21
21
|
6. After review, merge the pull request.
|
|
22
|
-
7. A second PR will be created by the release action.
|
|
23
|
-
8.
|
|
24
|
-
9. Github actions will automatically increment the version and publish to NPM.
|
|
22
|
+
7. A second PR will be created and auto-merged by the release action.
|
|
23
|
+
8. Github actions will automatically increment the version and publish to NPM.
|
package/README.md
CHANGED
|
@@ -15,6 +15,19 @@ npm install --save @defra/grants-config-utils
|
|
|
15
15
|
|
|
16
16
|
Refer to the [contributing documentation](CONTRIBUTING.md).
|
|
17
17
|
|
|
18
|
+
## Environment Variables
|
|
19
|
+
|
|
20
|
+
The following variables are used in this module:
|
|
21
|
+
|
|
22
|
+
- `SERVICE_VERSION` - **Required** This is the CDP service version that should be injected automatically in all consuming services
|
|
23
|
+
- `AWS_REGION` - **Required** Region where the service is deployed
|
|
24
|
+
- `CONFIG_BUCKET_NAME` - **Required** The S3 bucket where the config is to be stored
|
|
25
|
+
- `FORCE_PATH_STYLE` - Optional flag to force path style URLs when using S3 bucket (default true)
|
|
26
|
+
- `AWS_ENDPOINT_URL` - Optional AWS endpoint URL for local development
|
|
27
|
+
- `GRANTS_CONFIG_BROKER_AUTH_TOKEN` - **Required** Auth token for the grants config broker API
|
|
28
|
+
- `GRANTS_CONFIG_BROKER_ENCRYPTION_KEY` - **Required** Encryption key for the grants config broker API
|
|
29
|
+
- `GRANTS_CONFIG_BROKER_API_ENDPOINT` - **Required** Endpoint for the grants config broker API
|
|
30
|
+
|
|
18
31
|
## Licence
|
|
19
32
|
|
|
20
33
|
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
|