@@ -7,15 +7,17 @@ if [ -z "$INPUT_OPENAI_API_KEY" ]; then
77else
88 echo " OPENAI_API_KEY is set."
99fi
10- # GITHUB_TOKEN is an environment variable automatically provided by GitHub Actions
11- if [ -z " $INPUT_GITHUB_TOKEN " ]; then
12- echo " ::error::GITHUB_TOKEN is not set! This should be automatically provided by GitHub Actions."
10+
11+ # GH_TOKEN is expected to be in the environment, passed from the workflow
12+ if [ -z " $GH_TOKEN " ]; then
13+ echo " ::error::GH_TOKEN is not set! It should be passed from the workflow env context (e.g., env: GH_TOKEN: ${{ github.token } })."
14+ exit 1 # Exit if GH_TOKEN is not available
1315else
14- echo " GITHUB_TOKEN is set."
16+ echo " GH_TOKEN is set."
1517fi
1618
1719export OPENAI_API_KEY=" $INPUT_OPENAI_API_KEY "
18- export GH_TOKEN= " $INPUT_GITHUB_TOKEN " # GH_TOKEN is used by gh cli, set it from the default GITHUB_TOKEN
20+ export GH_TOKEN # Ensure GH_TOKEN is exported for gh cli and git operations
1921export INPUT_OPENAI_MODEL_NAME=" ${INPUT_OPENAI_MODEL_NAME:- gpt-4.1} " # Pass model name to script
2022export INPUT_PROCESS_CHANGED_FILES_ONLY=" ${INPUT_PROCESS_CHANGED_FILES_ONLY:- false} " # Pass changed files flag to script
2123
@@ -75,7 +77,7 @@ if [ "$MODIFIED_COUNT" -gt 0 ]; then
7577 DIFF_CONTENT=$( git diff --staged) # Get diff of staged changes
7678
7779 git commit -m " feat(bot): Apply AI-suggested accessibility improvements"
78- git push " https://x-access-token:$GITHUB_TOKEN @github.com/$GITHUB_REPOSITORY .git" " $BRANCH "
80+ git push " https://x-access-token:$GH_TOKEN @github.com/$GITHUB_REPOSITORY .git" " $BRANCH " # Use GH_TOKEN for push
7981
8082 # Create Pull Request using GitHub CLI
8183 echo " Creating Pull Request..."
0 commit comments