-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add workflow to check for non-releasable actions (#588)
* Add workflow * Try toJSON * Rename * Refactor * Prettify * Fix actionLint * Remove newline from print * Disable shellcheck * Disable shellcheck * Add comment for the shellcheck disable * Add remaining actions and update READMEs * Update .github/workflows/check-for-non-releasable-actions.yaml Co-authored-by: Horst Gutmann <[email protected]> * Try with cache * Try without jsonnet * Trigger on workflow changes * Add release-please-config.json as trigger * Replace with JS script * Add step name --------- Co-authored-by: Horst Gutmann <[email protected]>
- Loading branch information
1 parent
9bf9163
commit e16bf1a
Showing
6 changed files
with
99 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Check for non-releasable actions | ||
on: | ||
pull_request: | ||
paths: | ||
- actions/ | ||
- .github/workflows/check-for-non-releasable-actions.yaml | ||
- release-please-config.json | ||
types: | ||
- edited | ||
- opened | ||
- ready_for_review | ||
- synchronize | ||
|
||
push: | ||
branches: | ||
- main | ||
paths: | ||
- actions/ | ||
- .github/workflows/check-for-non-releasable-actions.yaml | ||
- release-please-config.json | ||
|
||
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@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!'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters