akhaliq HF Staff commited on
Commit
51bcded
·
1 Parent(s): 04e1fb9
Files changed (3) hide show
  1. README.md +1 -0
  2. backend_api.py +1 -1
  3. backend_deploy.py +3 -1
README.md CHANGED
@@ -11,6 +11,7 @@ hf_oauth: true
11
  hf_oauth_expiration_minutes: 43200
12
  hf_oauth_scopes:
13
  - manage-repos
 
14
  ---
15
 
16
  > **Note:** This is the Docker Space configuration for the React frontend version.
 
11
  hf_oauth_expiration_minutes: 43200
12
  hf_oauth_scopes:
13
  - manage-repos
14
+ - write-discussions
15
  ---
16
 
17
  > **Note:** This is the Docker Space configuration for the React frontend version.
backend_api.py CHANGED
@@ -119,7 +119,7 @@ app = FastAPI(title="AnyCoder API", version="1.0.0")
119
  # OAuth and environment configuration (must be before CORS)
120
  OAUTH_CLIENT_ID = os.getenv("OAUTH_CLIENT_ID", "")
121
  OAUTH_CLIENT_SECRET = os.getenv("OAUTH_CLIENT_SECRET", "")
122
- OAUTH_SCOPES = os.getenv("OAUTH_SCOPES", "openid profile manage-repos")
123
  OPENID_PROVIDER_URL = os.getenv("OPENID_PROVIDER_URL", "https://huggingface.co")
124
  SPACE_HOST = os.getenv("SPACE_HOST", "localhost:7860")
125
 
 
119
  # OAuth and environment configuration (must be before CORS)
120
  OAUTH_CLIENT_ID = os.getenv("OAUTH_CLIENT_ID", "")
121
  OAUTH_CLIENT_SECRET = os.getenv("OAUTH_CLIENT_SECRET", "")
122
+ OAUTH_SCOPES = os.getenv("OAUTH_SCOPES", "openid profile manage-repos write-discussions")
123
  OPENID_PROVIDER_URL = os.getenv("OPENID_PROVIDER_URL", "https://huggingface.co")
124
  SPACE_HOST = os.getenv("SPACE_HOST", "localhost:7860")
125
 
backend_deploy.py CHANGED
@@ -1431,8 +1431,9 @@ Generated by [AnyCoder](https://huggingface.co/spaces/akhaliq/anycoder)"""
1431
  )
1432
 
1433
  print(f"[PR] Prepared {len(operations)} file operations")
 
1434
 
1435
- # Create commit with PR (token already in HfApi instance)
1436
  commit_info = api.create_commit(
1437
  repo_id=repo_id,
1438
  repo_type="space",
@@ -1440,6 +1441,7 @@ Generated by [AnyCoder](https://huggingface.co/spaces/akhaliq/anycoder)"""
1440
  commit_message=pr_title,
1441
  commit_description=pr_description,
1442
  create_pr=True, # This creates a PR with the changes
 
1443
  )
1444
 
1445
  # Extract PR URL
 
1431
  )
1432
 
1433
  print(f"[PR] Prepared {len(operations)} file operations")
1434
+ print(f"[PR] Token being used (first 20 chars): {token[:20] if token else 'None'}...")
1435
 
1436
+ # Create commit with PR (pass token explicitly)
1437
  commit_info = api.create_commit(
1438
  repo_id=repo_id,
1439
  repo_type="space",
 
1441
  commit_message=pr_title,
1442
  commit_description=pr_description,
1443
  create_pr=True, # This creates a PR with the changes
1444
+ token=token, # Explicitly pass token
1445
  )
1446
 
1447
  # Extract PR URL