Skip to content

ci: Add update-nixpkgs tooling #1

ci: Add update-nixpkgs tooling

ci: Add update-nixpkgs tooling #1

name: update-nixpkgs-on-merge
on:
pull_request:
types:
- closed
jobs:
update-nixpkgs-on-merge:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'nixpkgs-auto-update/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NIXPKGS_UPDATE_APP_ID }}
private-key: ${{ secrets.NIXPKGS_UPDATE_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- run: |
echo "::add-mask::${{steps.app-token.outputs.token}}"
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- run: |
pip install pygithub gitpython
- run: |
python ci/update-nixpkgs-on-merge.py \
--merged-pr-id ${{ github.event.number }} \
--nixpkgs-dir ../nixpkgs \
--nixpkgs-origin-url https://x-access-token:${{steps.app-token.outputs.token}}@github.com/flyingcircusio/nixpkgs.git
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}