-
-
Notifications
You must be signed in to change notification settings - Fork 6
doc: update documentation #1167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| # Updatecli Github Action | ||
|
|
||
| * [Usage](#usage) | ||
| * [Updatecli version file](#updatecli-version-file) | ||
| * [Workflow](#workflow) | ||
| * [Deprecation](#deprecation) | ||
| * [Manual setup](#manual-setup) | ||
| * [Scaffold the workflows with an Updatecli policy](#scaffold-the-workflows-with-an-updatecli-policy) | ||
| * [Keep the workflows up to date](#keep-the-workflows-up-to-date) | ||
| * [Deprecation](#deprecation) | ||
| * [License](#license) | ||
|
|
||
| ## Usage | ||
|
|
@@ -15,6 +19,13 @@ Install Updatecli for GitHub Action | |
|
|
||
| - `version-file`: The path to a file containing updatecli version. Supported file types are `.updatecli-version` and `.tool-versions`. See more details in [about version-file](#Updatecli-version-file). | ||
|
|
||
| Please check whether you need to allow Github Action tokens to create pull | ||
| requests in the repository settings in addition to granting write permissions in | ||
| the workflow. This is [required by GitHub in new repositories](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests). | ||
|
|
||
| Go to the Repository Settings → "Actions" → "General" → "Workflow permissions" | ||
| and enable "Allow GitHub Actions to create and approve pull requests" | ||
|
|
||
| ### Updatecli version file | ||
|
|
||
| If the `version-file` input is specified, the action will extract the version from the file and install it. | ||
|
|
@@ -30,6 +41,10 @@ If the file contains multiple versions, only the first one will be recognized. | |
|
|
||
| ### Workflow | ||
|
|
||
| #### Manual setup | ||
|
|
||
| The minimal workflow to install and run Updatecli on a schedule: | ||
|
|
||
| ```yaml | ||
| name: updatecli | ||
|
|
||
|
|
@@ -59,34 +74,140 @@ jobs: | |
| uses: updatecli/updatecli-action@v3.6.0 | ||
|
|
||
| - name: Run Updatecli in Dry Run mode | ||
| run: updatecli diff | ||
| run: updatecli pipeline diff --config updatecli/updatecli.d | ||
| env: | ||
| UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Run Updatecli in Apply mode | ||
| run: updatecli apply --config updatecli/updatecli.d | ||
| run: updatecli pipeline apply --config updatecli/updatecli.d | ||
| env: | ||
| UPDATECLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| ``` | ||
|
|
||
| Please check whether you need to allow Github Action tokens to create pull | ||
| requests in the repository settings in addition to granting write permissions in | ||
| the workflow. This is [required by GitHub in new repositories](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests). | ||
| WARNING: Dont enable --debug mode in Github Action as it may leak information. | ||
| ======= | ||
| > [!WARNING] | ||
| > Do not enable `--debug` mode in GitHub Actions as it may leak information. | ||
|
|
||
| Go to the Repository Settings → "Actions" → "General" → "Workflow permissions" | ||
| and enable "Allow GitHub Actions to create and approve pull requests" | ||
| #### Scaffold the workflows with an Updatecli policy | ||
|
|
||
| WARNING: Dont enable --debug mode in Github Action as it may leak information. | ||
| Instead of writing the workflows by hand, the `updatecli/githubaction/scaffold` policy generates | ||
| them, and re-renders them on every run so their pinned action digests never go stale. | ||
|
|
||
| | File | Trigger | What it does | | ||
| | --- | --- | --- | | ||
| | `.github/workflows/updatecli.yaml` | `release`, `workflow_dispatch`, `schedule` | `updatecli compose apply`, opens pull requests | | ||
| | `.github/workflows/updatecli_test.yaml` | `pull_request` | `updatecli compose diff`, read only dry run | | ||
| | `.github/workflows/updatecli_update.yaml` | `workflow_dispatch`, push to the default branch, `schedule` | `updatecli compose apply` over a job matrix, refreshes the pull requests already opened | | ||
|
|
||
| Worth knowing before you run it: | ||
|
|
||
| * the generated workflows all run `updatecli compose`, so your repository needs an | ||
| `updatecli-compose.yaml`. This policy does not create one for you. | ||
| * the three workflow files become policy owned. They are rewritten in full on every run, so any | ||
| hand edit is reverted. Use the `gha.steps` value to add your own steps. | ||
| * writing into `.github/workflows/` requires a token with the `workflow` scope on top of `repo`. | ||
| * do not run it alongside `ghcr.io/updatecli/policies/updatecli/githubaction`. Both rewrite the | ||
| same files and would revert each other on every run. | ||
|
|
||
| From the root of your repository: | ||
|
|
||
| ```bash | ||
| # The policy reads its token from GITHUB_TOKEN, configurable with the scm.env_token value | ||
| export GITHUB_TOKEN=<PAT with the repo and workflow scopes> | ||
|
|
||
| # To show what would be created | ||
| updatecli diff ghcr.io/updatecli/policies/updatecli/githubaction/scaffold:0.1.1 | ||
| # To apply the changes if you are happy with the diff | ||
| updatecli apply ghcr.io/updatecli/policies/updatecli/githubaction/scaffold:0.1.1 | ||
|
Comment on lines
+120
to
+122
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | 🏗️ Heavy lift Security Misconfiguration Reachability: External Pin remote policy references to immutable digests. A tag can change between 🤖 Prompt for AI Agents🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
printf '%s\n' '--- README.md ---'
sed -n '112,128p' README.md
printf '%s\n' '--- .github/workflows/test.yaml ---'
sed -n '34,46p' .github/workflows/test.yaml
printf '%s\n' '--- command references ---'
rg -n --glob '!node_modules' 'updatecli (diff|apply|pipeline (diff|apply))' README.md .githubRepository: updatecli/updatecli-action Length of output: 1766 🌐 Web query:
💡 Result: In Updatecli, the diff and apply commands are used to manage the execution of pipelines, allowing users to preview or enact changes defined by their policies [1]. The diff command is used to simulate the execution of a pipeline [1]. It evaluates the defined policy and identifies potential updates without making any actual modifications to the target repositories or files. This is useful for reviewing what changes would occur before committing to them [1]. The apply command executes the pipeline to actually perform the updates [1]. When run, it applies the changes defined in the pipeline configuration to the specified targets. These commands can be used with standard pipelines or with compose files, for example: # Perform a dry-run to preview changes updatecli compose diff --file updatecli-compose.yaml # Execute the updates updatecli compose apply --file updatecli-compose.yaml These commands form the core workflow for verifying and implementing dependency updates through Updatecli automation [1]. Citations: 🏁 Script executed: #!/bin/bash
sed -n '112,128p' README.md
sed -n '34,46p' .github/workflows/test.yaml
rg -n --glob '!node_modules' 'updatecli (diff|apply|pipeline (diff|apply))' README.md .githubRepository: updatecli/updatecli-action Length of output: 1685 🌐 Web query:
💡 Result: In Updatecli, the command updatecli diff has been deprecated in favor of the new command updatecli pipeline diff [1][2][3]. This change was introduced to provide a more consistent command structure, organizing pipeline-related tasks under a new pipeline parent command, similar to how manifest and compose commands are structured [1]. While updatecli diff remains functional for backward compatibility, it now issues deprecation warning messages when executed [1]. Users are encouraged to migrate to the new command structure: - Use updatecli pipeline diff instead of updatecli diff [1][4]. - Use updatecli pipeline apply instead of updatecli apply [1][3]. - Use updatecli pipeline prepare instead of updatecli prepare [1]. Both the old and new command paths route to the same underlying execution logic, so there are no breaking changes to your existing workflows, though updating to the new syntax is recommended to avoid future issues [1]. Citations:
Replace the deprecated commands in the scaffold example and workflow. Use Proposed command update-updatecli diff ghcr.io/updatecli/policies/updatecli/githubaction/scaffold:0.1.1
+updatecli pipeline diff ghcr.io/updatecli/policies/updatecli/githubaction/scaffold:0.1.1
-updatecli apply ghcr.io/updatecli/policies/updatecli/githubaction/scaffold:0.1.1
+updatecli pipeline apply ghcr.io/updatecli/policies/updatecli/githubaction/scaffold:0.1.1- run: updatecli diff --config testdata/updatecli.d/test.yaml
+ run: updatecli pipeline diff --config testdata/updatecli.d/test.yaml🤖 Prompt for AI Agents |
||
| ``` | ||
|
|
||
| Run that way the policy uses its default `scm.enabled: false`: the workflows are written to your | ||
| working copy, and committing them is up to you. | ||
|
|
||
| The policy documentation can be found [here](https://github.com/updatecli/policies/tree/main/updatecli/policies/updatecli/githubaction/scaffold). | ||
|
|
||
| #### Keep the workflows up to date | ||
|
|
||
| To keep the generated workflows in sync with the policy, declare it in an Updatecli compose file | ||
| instead of running it once. That compose file is also the one the generated workflows execute. | ||
|
|
||
| `updatecli-compose.yaml` | ||
|
|
||
| ```yaml | ||
| # export GITHUB_TOKEN=<PAT with the repo and workflow scopes> | ||
| # export UPDATECLI_GITHUB_TOKEN=<PAT used by your own manifests> | ||
| # updatecli compose diff | ||
| # updatecli compose apply | ||
|
|
||
| name: Default Updatecli Policies | ||
|
|
||
| valuesinline: | ||
| scm: | ||
| enabled: true | ||
| user: updatecli | ||
| email: bot@updatecli.io | ||
| owner: <replace with your GitHub organization> | ||
| repository: <replace with your GitHub repository> | ||
| username: "updatecli-bot" | ||
| branch: main | ||
|
|
||
| policies: | ||
| - name: Local Updatecli policies | ||
| id: local | ||
| config: | ||
| - updatecli/updatecli.d | ||
|
|
||
| - name: Configure Updatecli workflows | ||
| id: updatecli | ||
| policy: ghcr.io/updatecli/policies/updatecli/githubaction/scaffold:0.1.1 | ||
| valuesinline: | ||
| gha: | ||
| # Credentials referenced by the generated workflows | ||
| # token -> secrets.GITHUB_TOKEN, works with no further setup | ||
| # app -> UPDATECLIBOT_APP_* secrets, the default, used by the Updatecli project itself | ||
| auth: token | ||
| udash: | ||
| # Reports the pipeline results to Udash, requires the UPDATECLI_UDASH_* secrets | ||
| enabled: false | ||
| apply: | ||
| # Opens new pull requests, default "0 12 */14 * *" | ||
| cron: "0 12 */14 * *" | ||
| update: | ||
| # Refreshes the existing ones, default "0 1 * * *" | ||
| cron: "0 3 * * *" | ||
| matrix: | ||
| - target_name: "existing pipelines" | ||
| apply_args: "--existing-only=true" | ||
| # Only useful if you label your manifests with "monitor: active" | ||
| - target_name: "monitored pipelines" | ||
| apply_args: "--labels=monitor:active" | ||
| ``` | ||
|
|
||
| With this configuration, the policy installs the three workflows described above: | ||
|
|
||
| * `updatecli.yaml` opens new pull requests every two weeks, as set by `gha.apply.cron` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- README.md ---'
sed -n '180,194p' README.md
printf '%s\n' '--- workflow schedule references ---'
rg -n -C 3 '0 12 \*/14 \* \*|gha\.apply\.cron|cron:' .github README.md updatecli.yaml updatecli.d 2>/dev/null || trueRepository: updatecli/updatecli-action Length of output: 3695 Describe the actual cron schedule.
🤖 Prompt for AI Agents |
||
| * `updatecli_update.yaml` refreshes the pull requests already opened by Updatecli, on every push to | ||
| the default branch and once a day at 3 AM UTC, as set by `gha.update.cron` | ||
| * `updatecli_test.yaml` runs Updatecli in dry run mode on every pull request | ||
|
|
||
| More Updatecli policies are available on [updatecli/policies](https://github.com/updatecli/policies). | ||
| >>>>>>> 8d9036c (doc: update documentation) | ||
|
|
||
| ## Deprecation | ||
|
|
||
| > [!IMPORTANT] | ||
| > The branch v1 and v2 are deprecated and will be remove soon. | ||
| > The branch v1 and v2 are deprecated and will be removed at some point. | ||
| > You should use GitHub action version instead (or track the main branch if you really want to). | ||
| > You can migrate to the latest GitHub action version using the following Updatecli policy: | ||
|
|
||
| .updatecli-compose.yaml | ||
| ``` | ||
| This policy patches the `uses:` and `with.version` of your existing workflows. It is an | ||
| alternative to the [scaffold policy](#scaffold-the-workflows-with-an-updatecli-policy), not a | ||
| companion: running both continuously makes them revert each other on every run. | ||
|
|
||
| `updatecli-compose.yaml` | ||
|
|
||
| ```yaml | ||
| # export UPDATECLI_GITHUB_TOKEN=<insert PAT> | ||
| # export UPDATECLI_GITHUB_USERNAME=<insert username> | ||
| # updatecli compose diff --file updatecli-compose.yaml | ||
|
|
@@ -105,10 +226,10 @@ valuesinline: | |
|
|
||
| policies: | ||
| - name: Update Updatecli GitHub action version | ||
| policy: ghcr.io/updatecli/policies/updatecli/githubaction:0.8.1 | ||
| policy: ghcr.io/updatecli/policies/updatecli/githubaction:0.9.1 | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| MIT. See `LICENSE` for more details. | ||
| Apache-2.0. See `LICENSE` for more details. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the unresolved merge artifacts from
README.md.The old warning and
=======separator at lines 87–90 render as a heading before the replacement alert. The>>>>>>> 8d9036c (doc: update documentation)marker at line 195 renders as visible text. Keep only the replacement warning alert and remove the marker.🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 87-87: Heading style
Expected: atx; Actual: setext
(MD003, heading-style)
🤖 Prompt for AI Agents