-
Notifications
You must be signed in to change notification settings - Fork 180
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
docs: automatic updating using github actions #1456
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1342ea0
docs: automatic updating using github actions
pavelzw c469448
small improvements
pavelzw 154f8fb
add workflow
pavelzw e0e7d0c
Merge branch 'main' into docs-lockfile-autoupdate
pavelzw 95734c4
update screenshots
pavelzw 9345b78
use conventional commits
pavelzw 854e5cf
Merge branch 'main' into docs-lockfile-autoupdate
tdejager File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Update lockfiles | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: 0 5 1 * * | ||
|
||
jobs: | ||
pixi-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up pixi | ||
uses: prefix-dev/[email protected] | ||
with: | ||
run-install: false | ||
- name: Update lockfiles | ||
run: | | ||
set -euo pipefail | ||
pixi global install pixi-diff-to-markdown | ||
pixi update --json --no-install | pixi-diff-to-markdown >> diff.md | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: 'bump: update pixi lockfile' | ||
title: 'bump: update pixi lockfile' | ||
body-path: diff.md | ||
branch: update-pixi | ||
base: main | ||
labels: pixi | ||
delete-branch: true | ||
add-paths: pixi.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
part: pixi/advanced | ||
title: Update lockfiles with GitHub Actions | ||
description: Learn how to use GitHub Actions to automatically update your pixi lockfiles. | ||
--- | ||
|
||
You can leverage GitHub Actions in combination with [pavelzw/pixi-diff-to-markdown](https://github.com/pavelzw/pixi-diff-to-markdown) | ||
to automatically update your lockfiles similar to dependabot or renovate in other ecosystems. | ||
|
||
![Update lockfiles](../assets/update-lockfile-light.png#only-light) | ||
![Update lockfiles](../assets/update-lockfile-dark.png#only-dark) | ||
|
||
!!!note "Dependabot/Renovate support for pixi" | ||
You can track native Dependabot support for pixi in [dependabot/dependabot-core #2227](https://github.com/dependabot/dependabot-core/issues/2227#issuecomment-1709069470) | ||
and for Renovate in [renovatebot/renovate #2213](https://github.com/renovatebot/renovate/issues/2213). | ||
|
||
## How to use | ||
|
||
To get started, create a new GitHub Actions workflow file in your repository. | ||
|
||
```yaml title=".github/workflows/update-lockfiles.yml" | ||
name: Update lockfiles | ||
|
||
permissions: # (1)! | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: 0 5 1 * * # (2)! | ||
|
||
jobs: | ||
pixi-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up pixi | ||
uses: prefix-dev/[email protected] | ||
with: | ||
run-install: false | ||
- name: Update lockfiles | ||
run: | | ||
pixi global install pixi-diff-to-markdown | ||
pixi update --json --no-install | pixi-diff-to-markdown >> diff.md | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Update pixi lockfile | ||
title: Update pixi lockfile | ||
body-path: diff.md | ||
branch: update-pixi | ||
base: main | ||
labels: pixi | ||
delete-branch: true | ||
add-paths: pixi.lock | ||
``` | ||
|
||
1. Needed for `peter-evans/create-pull-request` | ||
2. Runs at 05:00, on day 1 of the month | ||
|
||
In order for this workflow to work, you need to set "Allow GitHub Actions to create and approve pull requests" to true in your repository settings (in "Actions" -> "General"). | ||
|
||
![Allow GitHub Actions PRs](../assets/allow-github-actions-prs-light.png#only-light) | ||
![Allow GitHub Actions PRs](../assets/allow-github-actions-prs-dark.png#only-dark) | ||
|
||
## Triggering CI in automated PRs | ||
|
||
In order to prevent accidental recursive GitHub Workflow runs, GitHub decided to not trigger any workflows on automated PRs when using the default `GITHUB_TOKEN`. | ||
There are a couple of ways how to work around this limitation. You can find excellent documentation for this in `peter-evans/create-pull-request`, see [here](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs). | ||
|
||
## Customizing the summary | ||
|
||
You can customize the summary by either using command-line-arguments of `pixi-diff-to-markdown` or by specifying the configuration in `pixi.toml` under `[tool.pixi-diff-to-markdown]`. See the [pixi-diff-to-markdown documentation](https://github.com/pavelzw/pixi-diff-to-markdown) or run `pixi-diff-to-markdown --help` for more information. | ||
|
||
## Using reusable workflows | ||
|
||
If you want to use the same workflow in multiple repositories in your GitHub organization, you can create a reusable workflow. | ||
You can find more information in the [GitHub documentation](https://docs.github.com/en/actions/using-workflows/reusing-workflows). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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. you need to do this in your repo as well |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this currently results in the CI not being triggered when the PR is opened: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs
a workaround for this is to just close and re-open the PR.
otherwise we would need to add PATs, a GitHub App or an SSH deploy key for this to work
I think the close and reopen method is the easiest for this repo, especially when the PR is only coming around once a month