-
Notifications
You must be signed in to change notification settings - Fork 15
55 lines (47 loc) · 1.78 KB
/
check-for-non-releasable-actions.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Check for non-releasable actions
on:
pull_request:
types:
- edited
- opened
- ready_for_review
- synchronize
push:
branches:
- main
jobs:
check-for-non-releasable-actions:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
./actions
./release-please-config.json
- name: Check for non-releasable actions
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const fs = require('fs/promises');
const releasePleaseConfig = JSON.parse(await fs.readFile('release-please-config.json', 'utf-8'));
const configuredPackageNames = new Set(Object.keys(releasePleaseConfig.packages));
const packageNames = new Set();
const folders = await fs.readdir('actions', { withFileTypes: true });
for (const folder of folders) {
if (folder.isDirectory()) {
packageNames.add('actions/' + folder.name);
}
}
const missingConfigurations = [...packageNames].filter(pkg => !configuredPackageNames.has(pkg));
if (missingConfigurations.length > 0) {
console.log('The following actions are missing from the release-please-config.json file and thus won\'t be automatically released:');
console.log(missingConfigurations.join('\n'));
console.log('Please add them in release-please-config.json!');
} else {
console.log('All actions are releasable!');
}