@defra/grants-config-utils 0.1.0 → 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.
- package/.github/workflows/release.yml +54 -0
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
|
@@ -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