|
| 1 | +# Agent Guidelines |
| 2 | + |
| 3 | +This repository demonstrates the integration of `mage-remote-run` within GitHub Actions. |
| 4 | +It contains workflow configurations to automated testing and usage of the `mage-remote-run` tool. |
| 5 | + |
| 6 | +## 1. Build, Lint, and Test |
| 7 | + |
| 8 | +Since this is a configuration repository for GitHub Actions, "building" and "testing" primarily involve validating the YAML workflows. |
| 9 | + |
| 10 | +### Testing |
| 11 | +- **Local Validation**: Ensure `mage-remote-run` is installed locally to verify commands. |
| 12 | + ```bash |
| 13 | + # Check version |
| 14 | + mage-remote-run --version |
| 15 | + |
| 16 | + # Test connection (requires configured connection) |
| 17 | + mage-remote-run connection test |
| 18 | + ``` |
| 19 | +- **CI Validation**: The primary test is the GitHub Action itself defined in `.github/workflows/demo.yml`. |
| 20 | + |
| 21 | +### Linting |
| 22 | +- **YAML**: Ensure all `.yml` files in `.github/workflows` are valid YAML. |
| 23 | +- **Action Syntax**: Follow standard GitHub Actions syntax. |
| 24 | + |
| 25 | +## 2. Code Style & Conventions |
| 26 | + |
| 27 | +### Workflows (YAML) |
| 28 | +- **Indentation**: Use 2 spaces for indentation. |
| 29 | +- **Naming**: |
| 30 | + - Jobs and steps should have clear, descriptive names. |
| 31 | + - Environment variables should be uppercase (e.g., `MAGE_URL`). |
| 32 | +- **Secrets**: NEVER hardcode credentials. Always use `${{ secrets.VARIABLE_NAME }}`. |
| 33 | + - `MAGE_URL` |
| 34 | + - `MAGE_CONSUMER_KEY` |
| 35 | + - `MAGE_CONSUMER_SECRET` |
| 36 | + - `MAGE_ACCESS_TOKEN` |
| 37 | + - `MAGE_ACCESS_TOKEN_SECRET` |
| 38 | +- **Shell Commands**: |
| 39 | + - Use `|` for multi-line commands to improve readability. |
| 40 | + - Quote all variables in bash scripts (e.g., `"$MAGE_URL"`). |
| 41 | + |
| 42 | +### Tool Usage (`mage-remote-run`) |
| 43 | +- **Connection Setup**: |
| 44 | + - Use `connection add` with explicit flags for all parameters. |
| 45 | + - Always include `--no-test` in CI pipelines during the configuration step to separate configuration logic from connection verification. |
| 46 | + - Use `--active` to ensure the new connection is immediately usable. |
| 47 | +- **Command Structure**: |
| 48 | + ```bash |
| 49 | + mage-remote-run connection add \ |
| 50 | + --name "ProfileName" \ |
| 51 | + --type "ac-on-prem" \ |
| 52 | + ... flags |
| 53 | + ``` |
| 54 | + |
| 55 | +### Project Structure |
| 56 | +- `.github/workflows/`: Contains all CI/CD definitions. |
| 57 | +- `README.md`: Documentation for the example. |
| 58 | + |
| 59 | +## 3. Error Handling |
| 60 | +- In CI steps that might fail due to missing secrets (like connection tests in a demo), use `continue-on-error: true` if the failure is expected or acceptable for the demonstration. |
| 61 | +- In production scripts, fail fast on error. |
| 62 | + |
| 63 | +## 4. Updates |
| 64 | +- When updating the `mage-remote-run` version, check the [npm registry](https://www.npmjs.com/package/mage-remote-run) for the latest version and changelog. |
0 commit comments