CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes45downloads
integration-github-action.md242 linesDownload Raw Back to users
1# GitHub Actions:qwen-code-action2 3## Overview4 5`qwen-code-action` is a GitHub Action that integrates [Qwen Code] into your development workflow via the [Qwen Code CLI]. It acts both as an autonomous agent for critical routine coding tasks, and an on-demand collaborator you can quickly delegate work to.6 7Use it to perform GitHub pull request reviews, triage issues, perform code analysis and modification, and more using [Qwen Code] conversationally (e.g., `@qwencoder fix this issue`) directly inside your GitHub repositories.8 9## Features10 11- **Automation**: Trigger workflows based on events (e.g. issue opening) or schedules (e.g. nightly).12- **On-demand Collaboration**: Trigger workflows in issue and pull request13  comments by mentioning the [Qwen Code CLI](./features/commands) (e.g., `@qwencoder /review`).14- **Extensible with Tools**: Leverage [Qwen Code](../developers/tools/introduction.md) models' tool-calling capabilities to interact with other CLIs like the [GitHub CLI] (`gh`).15- **Customizable**: Use a `QWEN.md` file in your repository to provide16  project-specific instructions and context to [Qwen Code CLI](./features/commands).17 18## Quick Start19 20Get started with Qwen Code CLI in your repository in just a few minutes:21 22### 1. Get a Qwen API Key23 24Obtain your API key from [DashScope](https://help.aliyun.com/zh/model-studio/qwen-code) (Alibaba Cloud's AI platform)25 26### 2. Add it as a GitHub Secret27 28Store your API key as a secret named `QWEN_API_KEY` in your repository:29 30- Go to your repository's **Settings > Secrets and variables > Actions**31- Click **New repository secret**32- Name: `QWEN_API_KEY`, Value: your API key33 34### 3. Update your .gitignore35 36Add the following entries to your `.gitignore` file:37 38```gitignore39# qwen-code-cli settings40.qwen/41 42# GitHub App credentials43gha-creds-*.json44```45 46### 4. Choose a Workflow47 48You have two options to set up a workflow:49 50**Option A: Use setup command (Recommended)**51 521. Start the Qwen Code CLI in your terminal:53 54   ```shell55   qwen56   ```57 582. In Qwen Code CLI in your terminal, type:59 60   ```61   /setup-github62   ```63 64**Option B: Manually copy workflows**65 661. Copy the pre-built workflows from the [`examples/workflows`](./common-workflow) directory to your repository's `.github/workflows` directory. Note: the `qwen-dispatch.yml` workflow must also be copied, which triggers the workflows to run.67 68### 5. Try it out69 70**Pull Request Review:**71 72- Open a pull request in your repository and wait for automatic review73- Comment `@qwencoder /review` on an existing pull request to manually trigger a review74 75**Issue Triage:**76 77- Open an issue and wait for automatic triage78- Comment `@qwencoder /triage` on existing issues to manually trigger triaging79 80**General AI Assistance:**81 82- In any issue or pull request, mention `@qwencoder` followed by your request83- Examples:84  - `@qwencoder explain this code change`85  - `@qwencoder suggest improvements for this function`86  - `@qwencoder help me debug this error`87  - `@qwencoder write unit tests for this component`88 89## Workflows90 91This action provides several pre-built workflows for different use cases. Each workflow is designed to be copied into your repository's `.github/workflows` directory and customized as needed.92 93### Qwen Code Dispatch94 95This workflow acts as a central dispatcher for Qwen Code CLI, routing requests to the appropriate workflow based on the triggering event and the command provided in the comment. For a detailed guide on how to set up the dispatch workflow, go to the [Qwen Code Dispatch workflow documentation](./common-workflow).96 97### Issue Triage98 99This action can be used to triage GitHub Issues automatically or on a schedule. For a working issue triage setup, see the [automated issue triage workflow](https://github.com/QwenLM/qwen-code/blob/main/.github/workflows/qwen-automated-issue-triage.yml).100 101### Pull Request Review102 103This action can be used to automatically review pull requests when they are opened. For a detailed guide on how to set up the pull request review system, go to the [GitHub PR Review workflow documentation](./common-workflow).104 105### Qwen Code CLI Assistant106 107This type of action can be used to invoke a general-purpose, conversational Qwen Code AI assistant within the pull requests and issues to perform a wide range of tasks. For a detailed guide on how to set up the general-purpose Qwen Code CLI workflow, go to the [Qwen Code Assistant workflow documentation](./common-workflow).108 109## Configuration110 111### Inputs112 113<!-- BEGIN_AUTOGEN_INPUTS -->114 115- <a name="__input_qwen_api_key"></a><a href="#user-content-__input_qwen_api_key"><code>qwen*api_key</code></a>: *(Optional)\_ The API key for the Qwen API.116 117- <a name="__input_qwen_cli_version"></a><a href="#user-content-__input_qwen_cli_version"><code>qwen*cli_version</code></a>: *(Optional, default: `latest`)\_ The version of the Qwen Code CLI to install. Can be "latest", "preview", "nightly", a specific version number, or a git branch, tag, or commit. For more information, see [Qwen Code CLI releases](https://github.com/QwenLM/qwen-code-action/blob/main/docs/releases.md).118 119- <a name="__input_qwen_debug"></a><a href="#user-content-__input_qwen_debug"><code>qwen*debug</code></a>: *(Optional)\_ Enable debug logging and output streaming.120 121- <a name="__input_qwen_model"></a><a href="#user-content-__input_qwen_model"><code>qwen*model</code></a>: *(Optional)\_ The model to use with Qwen Code.122 123- <a name="__input_prompt"></a><a href="#user-content-__input_prompt"><code>prompt</code></a>: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Qwen Code CLI's [`--prompt` argument](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/configuration.md#command-line-arguments).124 125- <a name="__input_settings"></a><a href="#user-content-__input_settings"><code>settings</code></a>: _(Optional)_ A JSON string written to `.qwen/settings.json` to configure the CLI's _project_ settings.126  For more details, see the documentation on [settings files](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/configuration.md#settings-files).127 128- <a name="__input_use_qwen_code_assist"></a><a href="#user-content-__input_use_qwen_code_assist"><code>use*qwen_code_assist</code></a>: *(Optional, default: `false`)\_ Whether to use Code Assist for Qwen Code model access instead of the default Qwen Code API key.129  For more information, see the [Qwen Code CLI documentation](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/authentication.md).130 131- <a name="__input_use_vertex_ai"></a><a href="#user-content-__input_use_vertex_ai"><code>use*vertex_ai</code></a>: *(Optional, default: `false`)\_ Whether to use Vertex AI for Qwen Code model access instead of the default Qwen Code API key.132  For more information, see the [Qwen Code CLI documentation](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/authentication.md).133 134- <a name="__input_extensions"></a><a href="#user-content-__input_extensions"><code>extensions</code></a>: _(Optional)_ A list of Qwen Code CLI extensions to install.135 136- <a name="__input_upload_artifacts"></a><a href="#user-content-__input_upload_artifacts"><code>upload*artifacts</code></a>: *(Optional, default: `false`)\_ Whether to upload artifacts to the github action.137 138- <a name="__input_use_pnpm"></a><a href="#user-content-__input_use_pnpm"><code>use*pnpm</code></a>: *(Optional, default: `false`)\_ Whether or not to use pnpm instead of npm to install qwen-code-cli139 140- <a name="__input_workflow_name"></a><a href="#user-content-__input_workflow_name"><code>workflow*name</code></a>: *(Optional, default: `${{ github.workflow }}`)\_ The GitHub workflow name, used for telemetry purposes.141 142<!-- END_AUTOGEN_INPUTS -->143 144### Outputs145 146<!-- BEGIN_AUTOGEN_OUTPUTS -->147 148- <a name="__output_summary"></a><a href="#user-content-__output_summary"><code>summary</code></a>: The summarized output from the Qwen Code CLI execution.149 150- <a name="__output_error"></a><a href="#user-content-__output_error"><code>error</code></a>: The error output from the Qwen Code CLI execution, if any.151 152<!-- END_AUTOGEN_OUTPUTS -->153 154### Repository Variables155 156We recommend setting the following values as repository variables so they can be reused across all workflows. Alternatively, you can set them inline as action inputs in individual workflows or to override repository-level values.157 158| Name               | Description                                               | Type     | Required | When Required             |159| ------------------ | --------------------------------------------------------- | -------- | -------- | ------------------------- |160| `DEBUG`            | Enables debug logging for the Qwen Code CLI.              | Variable | No       | Never                     |161| `QWEN_CLI_VERSION` | Controls which version of the Qwen Code CLI is installed. | Variable | No       | Pinning the CLI version   |162| `APP_ID`           | GitHub App ID for custom authentication.                  | Variable | No       | Using a custom GitHub App |163 164To add a repository variable:165 1661. Go to your repository's **Settings > Secrets and variables > Actions > New variable**.1672. Enter the variable name and value.1683. Save.169 170For details about repository variables, refer to the [GitHub documentation on variables][variables].171 172### Secrets173 174You can set the following secrets in your repository:175 176| Name              | Description                                   | Required | When Required                              |177| ----------------- | --------------------------------------------- | -------- | ------------------------------------------ |178| `QWEN_API_KEY`    | Your Qwen API key from DashScope.             | Yes      | Required for all workflows that call Qwen. |179| `APP_PRIVATE_KEY` | Private key for your GitHub App (PEM format). | No       | Using a custom GitHub App.                 |180 181To add a secret:182 1831. Go to your repository's **Settings > Secrets and variables >Actions > New repository secret**.1842. Enter the secret name and value.1853. Save.186 187For more information, refer to the [official GitHub documentation on creating and using encrypted secrets][secrets].188 189## Authentication190 191This action requires authentication to the GitHub API and optionally to Qwen Code services.192 193### GitHub Authentication194 195You can authenticate with GitHub in two ways:196 1971. **Default `GITHUB_TOKEN`:** For simpler use cases, the action can use the198   default `GITHUB_TOKEN` provided by the workflow.1992. **Custom GitHub App (Recommended):** For the most secure and flexible200   authentication, we recommend creating a custom GitHub App.201 202For detailed setup instructions for both Qwen and GitHub authentication, go to the203[**Authentication documentation**](./configuration/auth).204 205## Extensions206 207The Qwen Code CLI can be extended with additional functionality through extensions.208These extensions are installed from source from their GitHub repositories.209 210For detailed instructions on how to set up and configure extensions, go to the211[Extensions documentation](./extension/introduction.md).212 213## Best Practices214 215To ensure the security, reliability, and efficiency of your automated workflows, we strongly recommend following our best practices. These guidelines cover key areas such as repository security, workflow configuration, and monitoring.216 217Key recommendations include:218 219- **Securing Your Repository:** Implementing branch and tag protection, and restricting pull request approvers.220- **Monitoring and Auditing:** Regularly reviewing action logs and enabling OpenTelemetry for deeper insights into performance and behavior.221 222For a comprehensive guide on securing your repository and workflows, please refer to our [**Best Practices documentation**](./common-workflow).223 224## Customization225 226Create a QWEN.md file in the root of your repository to provide227project-specific context and instructions to [Qwen Code CLI](./common-workflow). This is useful for defining228coding conventions, architectural patterns, or other guidelines the model should229follow for a given repository.230 231## Contributing232 233Contributions are welcome! Check out the Qwen Code CLI **Contributing Guide** for more details on how to get started.234 235[secrets]: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions236[Qwen Code]: https://github.com/QwenLM/qwen-code237[DashScope]: https://dashscope.console.aliyun.com/apiKey238[Qwen Code CLI]: https://github.com/QwenLM/qwen-code-action/239[variables]: https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables#creating-configuration-variables-for-a-repository240[GitHub CLI]: https://docs.github.com/en/github-cli/github-cli241[QWEN.md]: https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/configuration.md#context-files-hierarchical-instructional-context242 
basant307/AI_Governance_Project · CoolFace