Nixpkgs Updater #241
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: Nixpkgs Updater | |
on: | |
schedule: | |
- cron: "12 4 * * *" | |
workflow_dispatch: {} | |
jobs: | |
sync_fork: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Sync fork | |
shell: bash | |
run: | | |
gh repo sync Shawn8901/nixpkgs --source NixOS/nixpkgs --branch master | |
gh repo sync Shawn8901/nixpkgs --source NixOS/nixpkgs --branch nixos-unstable | |
env: | |
GH_TOKEN: "${{ secrets.GH_TOKEN }}" | |
update-branch: | |
runs-on: ubuntu-22.04 | |
needs: [sync_fork] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
repository: "Shawn8901/nixpkgs" | |
token: "${{ secrets.GH_TOKEN }}" | |
- name: Set up git | |
shell: bash | |
run: | | |
git config user.email [email protected] | |
git config user.name "Git Bot" | |
- name: Fetch origin | |
shell: bash | |
run: | | |
git fetch origin | |
- name: Update custom branch | |
shell: bash | |
run: | | |
git checkout nixos-unstable-custom | |
commits_ahead=$(git rev-list --count nixos-unstable-custom..origin/nixos-unstable) | |
if [ $commits_ahead -eq 0 ] | |
then | |
exit 0 | |
fi | |
git rebase origin/nixos-unstable | |
git push --force-with-lease | |
env: | |
GH_TOKEN: "${{ secrets.GH_TOKEN }}" |