Skip to content

Commit 541bf48

Browse files
authored
feat(action): add module name output (#245)
1 parent a39ba3f commit 541bf48

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

.github/workflows/action-e2e.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
cd bazel-central-registry
3131
git init
3232
- name: Create entry
33+
id: create_entry
3334
uses: ./this
3435
with:
3536
tag: v1.0.0
@@ -39,6 +40,14 @@ jobs:
3940
local-registry: bazel-central-registry
4041
- name: Test entry content
4142
run: this/e2e/action/test-happy-path-content.sh
43+
- name: Test output
44+
run: |
45+
set -o errexit -o nounset -o pipefail -o xtrace
46+
47+
if [[ "${{ steps.create_entry.outputs.module-name }}" != "versioned" ]]; then
48+
echo "Expected output module-name to be 'versioned' but it was '${{ steps.create_entry.outputs.module-name }}'"
49+
exit 1
50+
fi
4251
test-github-repository-default:
4352
# Test that the `github-repository` input defaults to ${{ github.repository }}
4453
# indirectly by checking the resulting subtituted source.json file in the entry.

action.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ inputs:
4747
description: 'Directory containing BCR release template files: metadata.template.json, source.template.json, presubmit.yaml, patches/. Equivalent to the .bcr directory required by the legacy GitHub app.'
4848
required: false
4949
default: ''
50+
outputs:
51+
module-name:
52+
description: Name of the module from MODULE.bazel
5053
runs:
5154
using: 'node20'
5255
main: 'dist/action/index.js'

dist/action/index.js

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/application/action/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ async function main() {
6767
return;
6868
}
6969

70+
core.setOutput('module-name', cliOutput.moduleName);
71+
7072
await attest(inputs, cliOutput!);
7173
} catch (error) {
7274
core.setFailed(error.message);

0 commit comments

Comments
 (0)