Skip to content

Commit 67ee21d

Browse files
authored
fix assign bot to not always return 96 (#478)
1 parent cad1738 commit 67ee21d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/scripts/assign_xls_number.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,15 @@ def find_draft_xls_files(changed_files: list[str]) -> list[str]:
7676

7777
def main():
7878
"""Main entry point for the script."""
79-
# Get repository root (parent of .github directory)
80-
script_dir = Path(__file__).resolve().parent
81-
repo_root = script_dir.parent.parent
79+
# Get repository root from environment variable (set by GitHub Actions)
80+
# or fall back to calculating from script location
81+
repo_root_env = os.environ.get("REPO_ROOT")
82+
if repo_root_env:
83+
repo_root = Path(repo_root_env)
84+
else:
85+
# Fallback: parent of .github directory
86+
script_dir = Path(__file__).resolve().parent
87+
repo_root = script_dir.parent.parent
8288

8389
# Get changed files from command line arguments or environment variable
8490
if len(sys.argv) > 1:

.github/workflows/assign-xls-number.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ jobs:
6262
- name: Assign XLS number
6363
if: steps.check-drafts.outputs.has_drafts == 'true'
6464
id: assign-number
65+
env:
66+
REPO_ROOT: ${{ github.workspace }}
6567
run: |
6668
echo ${{ steps.check-drafts.outputs.draft_files }}
6769
python base-repo/.github/scripts/assign_xls_number.py ${{ steps.check-drafts.outputs.draft_files }}

0 commit comments

Comments
 (0)