Skip to content

Merge branch 'railwayapp:main' into main #55

Merge branch 'railwayapp:main' into main

Merge branch 'railwayapp:main' into main #55

name: Update Nixpkgs Archive
# on:
# schedule:
# # Every Monday at 5 PM (UTC)
# - cron: '0 17 * * 1'
env:
BRANCH_NAME: auto-update/nixpkgs-archive
GIT_AUTHOR_NAME: ${{ github.repository_owner }}
GIT_AUTHOR_EMAIL: ${{ github.repository_owner }}@users.noreply.github.com
jobs:
update-archive:
name: Update Archive
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install -y jq
- name: Update Archive
id: update-archive
shell: bash
run: |
REPO="NixOS/nixpkgs"
BRANCH="nixpkgs-unstable"
COMMIT_INFO="$(curl "https://api.github.com/repos/$REPO/commits/$BRANCH")"
SHA="$(echo $COMMIT_INFO | jq -r ".sha")"
URL="$(echo $COMMIT_INFO | jq -r ".html_url")"
DATE="$(date "+%Y-%m-%d %H:%M:%S %Z%z")"
sed -i "/\/\/ Last Modified:/c\/\/ Last Modified: ${DATE}" src/nixpacks/nix/mod.rs
sed -i "/\/\/ https:\/\/github.com\/NixOS\/nixpkgs\/commit/c\/\/ $URL" src/nixpacks/nix/mod.rs
sed -i "/const NIXPKGS_ARCHIVE: &str/c\pub const NIXPKGS_ARCHIVE: &str = \"$SHA\";" src/nixpacks/nix/mod.rs
echo "::set-output name=sha::$SHA"
echo "::set-output name=url::$URL"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.COMMITTER_TOKEN }}
title: Update nixpkgs archive
commit-message: Update nixpkgs archive to `${{ steps.update-archive.outputs.sha }}`
body: "[`${{ steps.update-archive.outputs.sha }}`](${{ steps.update-archive.outputs.url }})"
signoff: true
delete-branch: true
author: ${{ env.GIT_AUTHOR_NAME }} <${{ env.GIT_AUTHOR_EMAIL }}>
branch: ${{ env.BRANCH_NAME }}
labels: release/patch