Auto-update #1380
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
name: Auto-update | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
paths: | |
- '.github/workflows/auto-update.js' | |
- 'auto-update/lib.js' | |
- '.github/workflows/auto-update.yml' | |
schedule: | |
- cron: "30 11 */2 * *" | |
jobs: | |
update-sources: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v30 | |
with: | |
nix_path: nixpkgs=channel:nixpkgs-unstable | |
- name: "Update sources" | |
uses: actions/github-script@v7 | |
id: update-sources | |
with: | |
result-encoding: string | |
script: | | |
const script = require('./.github/workflows/auto-update.js') | |
return await script({github, context, core, require}) | |
- name: Commit updated flake | |
env: | |
GITHUB_JOB: ${{ env.GITHUB_JOB }} | |
GITHUB_RUN_ID: ${{ env.GITHUB_RUN_ID }} | |
run: | | |
git config --global user.name 'UpdateBot' | |
git config --global user.email '[email protected]' | |
git checkout -b "auto-update-sources-$GITHUB_RUN_ID" | |
git add flake.nix flake.lock | |
git commit -m "Update sources" | |
git push --set-upstream origin "auto-update-sources-$GITHUB_RUN_ID" | |
- name: Open pull request | |
uses: repo-sync/pull-request@v2 | |
env: | |
GITHUB_JOB: ${{ env.GITHUB_JOB }} | |
GITHUB_RUN_ID: ${{ env.GITHUB_RUN_ID }} | |
with: | |
destination_branch: "master" | |
source_branch: auto-update-sources-${{ github.run_id }} | |
pr_title: "Update sources" | |
pr_body: ":robot_face: Updating sources to the latest version.\n${{steps.update-sources.outputs.result}}" | |
github_token: ${{ secrets.GH_PAT_ANMONTEIRO }} |