Skip to content

Auto Pull Request

Auto Pull Request #33

Workflow file for this run

name: Auto Pull Request
on:
schedule:
- cron: "0 */2 * * *"
permissions: write-all
jobs:
auto-pull-request:
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
with:
ref: nixos-unstable
- name: Setup git
run: |
git config --global user.name 'little fmway'
git config --global user.email 'fm18lv@gmail.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
- name: Refresh Git Remote
run: git fetch origin
# - name: Refresh Your Head
# run: |
# git rebase origin/master nixos-unstable
# git push origin nixos-unstable --force
- name: Check if PR exists
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
prs=$(gh pr list \
--repo "$GITHUB_REPOSITORY" \
--head 'nixos-unstable' \
--base 'master' \
--json title \
--jq 'length')
count_commit=$(git rev-list --left-right --count origin/nixos-unstable...origin/master | awk '{print $1}')
if (( prs > 0 )) || (( count_commit < 1 )); then
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: '!steps.check.outputs.skip'
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
gh pr create --title "Merge From nixos-unstable" --body "" -l "automated"