Skip to content

Commit 8db4861

Browse files
committed
token file
1 parent 257cbcc commit 8db4861

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
fetch-depth: 0 # Required to get all history for git diff and base branch detection
1616
- name: Run Accessibility Bot
1717
uses: ./
18+
env:
19+
GH_TOKEN: ${{ github.token }} # Make GITHUB_TOKEN available as GH_TOKEN
1820
with:
1921
openai_api_key: ${{ secrets.OPENAI_API_KEY }}
2022
# openai_model_name: 'gpt-4-turbo' # Example of using a custom model

entrypoint.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ if [ -z "$INPUT_OPENAI_API_KEY" ]; then
77
else
88
echo "OPENAI_API_KEY is set."
99
fi
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
1315
else
14-
echo "GITHUB_TOKEN is set."
16+
echo "GH_TOKEN is set."
1517
fi
1618

1719
export 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
1921
export INPUT_OPENAI_MODEL_NAME="${INPUT_OPENAI_MODEL_NAME:-gpt-4.1}" # Pass model name to script
2022
export 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

Comments
 (0)