This guide covers how to authenticate the Qwen Code action in your GitHub Actions workflows.
The Qwen Code Action uses OpenAI-compatible API authentication through Alibaba Cloud's DashScope platform.
- A Qwen API key from DashScope.
- Create an API Key: Go to DashScope console and create a new API key.
- Add to GitHub Secrets: In your GitHub repository, go to Settings > Secrets and variables > Actions and add a new repository secret with the name
QWEN_API_KEYand paste your key as the value. - (Optional) Configure Base URL and Model: If you want to use a different endpoint or model, add repository variables:
QWEN_BASE_URL: Custom API endpoint (default:https://dashscope.aliyuncs.com/compatible-mode/v1)QWEN_MODEL: Model name (default:qwen-coder-plus-latest)
- uses: 'QwenLM/qwen-code-action@v1'
with:
prompt: |-
Explain this code
openai_api_key: '${{ secrets.QWEN_API_KEY }}'
openai_base_url: '${{ vars.QWEN_BASE_URL }}' # Optional
openai_model: '${{ vars.QWEN_MODEL }}' # OptionalThis action requires a GitHub token to interact with the GitHub API. You can authenticate in two ways:
For simpler scenarios, the action can authenticate using the default GITHUB_TOKEN that GitHub automatically creates for each workflow run.
Limitations:
- Limited permissions - you may need to grant additional permissions in your workflow file
- Job-scoped - access limited to the repository where the workflow runs
permissions:
contents: 'read'
issues: 'write'
pull-requests: 'write'For optimal security and control, create a custom GitHub App with fine-grained permissions.
- Create a new GitHub App at Settings > Developer settings > GitHub Apps
- Configure permissions (Contents, Issues, Pull requests: Read & write)
- Generate a private key and note the App ID
- Install the app in your repository
- Add
APP_ID(variable) andAPP_PRIVATE_KEY(secret) to your repository
For details, see the GitHub documentation.