Skip to content

Add more info to auto-PR links #23

Add more info to auto-PR links

Add more info to auto-PR links #23

name: Update downstream
on:
pull_request:
types:
- closed
jobs:
update-downstream-repos:
if: ${{ github.event.pull_request.merged }}
environment: detsys-pr-bot
name: Pull request detsys-ts update to ${{ github.repository_owner }}/${{ matrix.repo }}
runs-on: ubuntu-22.04
strategy:
matrix:
repo:
- flake-checker-action
- magic-nix-cache-action
- flakehub-push
- flakehub-mirror
- nix-installer-action
- update-flake-lock
env:
REF: ${{ github.sha }}
REF_URL: https://github.com/${{ github.repository }}/tree/${{ github.sha }}
SOURCE_REPO: ${{ github.repository }}
SOURCE_PR_NUMBER: ${{ github.event.pull_request.number }}
SOURCE_PR_URL: https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}
HEAD_REF: ${{ github.head_ref }}
HEAD_COMMIT_MSG: ${{ github.event.head_commit.message }}
DIFF_URL: https://github.com/${{ github.repository }}/compare/${{ github.head_ref }}..${{ github.sha }}
GIT_USER: ${{ github.actor }}
GIT_EMAIL: ${{ github.actor }}@users.noreply.github.com
GIT_BRANCH: detsys-ts-update-${{ github.sha }}
GIT_BASE: main
GIT_HEAD: detsys-pr-bot:detsys-ts-update-${{ github.sha }}
TARGET_REPO: ${{ github.repository_owner }}/${{ matrix.repo }}
GH_TOKEN: ${{ secrets.detsys_pr_bot_token }} # for `gh pr create`
steps:
- name: Check out ${{ env.TARGET_REPO }}
uses: actions/checkout@v4
with:
repository: ${{ env.TARGET_REPO }}
token: ${{ env.GH_TOKEN }}
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Set up Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Configure Git for ${{ env.GIT_USER }}
run: |
git config user.name "${{ env.GIT_USER }}"
git config user.email "${{ env.GIT_EMAIL }}"
- name: Make sure the repo is forked
run: |
gh repo fork
- name: Update `detsys-ts` dependency for ${{ env.TARGET_REPO }} to ref `${{ env.REF }}`
run: |
nix develop --command pnpm update detsys-ts
nix develop --command pnpm all
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.detsys_pr_bot_token }}
title: "Update `detsys-ts`: ${{ env.HEAD_COMMIT_MSG }}"
commit-message: "Update `detsys-ts` for: `${{ env.HEAD_COMMIT_MSG }}` (`${{ env.REF }}`)"
body: |
Bump [`detsys-ts`](${{ env.SOURCE_REPO }}) to the latest `HEAD` and regenerate application bundle.
* Source ref: [`${{ env.REF }}`](${{ env.REF_URL }})
* Source pull request: [`${{ env.SOURCE_REPO }}#${{ env.SOURCE_PR_NUMBER }}`](${{ env.SOURCE_PR_URL }})
* Source diff: [`${{ env.HEAD_REF }}..${{ env.REF }}`](${{ env.DIFF_URL }})
push-to-fork: detsys-pr-bot/${{ matrix.repo }}
branch: "${{ env.GIT_BRANCH }}"
base: ${{ env.GIT_BASE }}
draft: false