Skip to content

Commit 894e88f

Browse files
committed
feat(action): add module name output
1 parent a4fa63b commit 894e88f

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

.github/workflows/action-e2e.yaml

Lines changed: 9 additions & 4 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,10 +40,14 @@ jobs:
3940
local-registry: bazel-central-registry
4041
- name: Test entry content
4142
run: this/e2e/action/test-happy-path-content.sh
42-
test-github-repository-default:
43-
# Test that the `github-repository` input defaults to ${{ github.repository }}
44-
# indirectly by checking the resulting subtituted source.json file in the entry.
45-
runs-on: ubuntu-latest
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
4651
steps:
4752
- uses: actions/checkout@v2
4853
with:

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
@@ -62,6 +62,8 @@ async function main() {
6262

6363
const { code, output: cliOutput } = await executeCli(cliBin, cliArgs);
6464

65+
core.setOutput('module-name', cliOutput.moduleName);
66+
6567
if (code !== 0) {
6668
core.setFailed(`CLI exited with code ${code}`);
6769
return;

0 commit comments

Comments
 (0)