Skip to content

Commit 19dcb40

Browse files
authored
[CI] Allow passing custom path to workspace file (#1523)
[skip ci]
1 parent 992f348 commit 19dcb40

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/update-dependency.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ on:
2626
required: false
2727
type: 'string'
2828
default: 'main'
29+
workspace_path:
30+
description: 'The path to the Bazel workspace file'
31+
required: false
32+
type: 'string'
33+
default: 'workspace.bzl'
34+
2935

3036
jobs:
3137
pr-update-dep:
@@ -49,7 +55,7 @@ jobs:
4955
- name: Get upstream commit
5056
shell: bash
5157
run: |
52-
OLD_UPSTREAM_COMMIT=$(grep '${{ inputs.variable_name }} *= *".*"' workspace.bzl | cut -d= -f2 | tr -d '" ')
58+
OLD_UPSTREAM_COMMIT=$(grep '${{ inputs.variable_name }} *= *".*"' ${{ inputs.workspace_path }} | cut -d= -f2 | tr -d '" ')
5359
5460
if [[ -n '${{ inputs.upstream_commit }}' ]]; then
5561
NEW_UPSTREAM_COMMIT="${{ inputs.upstream_commit }}"
@@ -62,7 +68,7 @@ jobs:
6268
echo "DIFF_MSG=Diff: https://github.com/${{ inputs.upstream_repo }}/compare/${OLD_UPSTREAM_COMMIT}...${NEW_UPSTREAM_COMMIT}" >> "${GITHUB_ENV}"
6369
- name: Modify upstream commit
6470
run: |
65-
sed -i 's/${{ inputs.variable_name }} *= *".*"/${{ inputs.variable_name }} = "${{ env.NEW_UPSTREAM_COMMIT }}"/' workspace.bzl
71+
sed -i 's/${{ inputs.variable_name }} *= *".*"/${{ inputs.variable_name }} = "${{ env.NEW_UPSTREAM_COMMIT }}"/' ${{ inputs.workspace_path }}
6672
- name: Decide whether to open the pull request
6773
id: decide
6874
run: |

0 commit comments

Comments
 (0)