Skip to content

Update propagate-main-to-v7.1.yml to use a PAT (#565) #37

Update propagate-main-to-v7.1.yml to use a PAT (#565)

Update propagate-main-to-v7.1.yml to use a PAT (#565) #37

# This action will copy changes from main into the v7.1 branch, and is done whenever the main branch is updated.
#
# For documentation on the github environment, see
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
#
# For documentation on the syntax of this file, see
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
---
name: Propagate main to 7.1
on:
push:
branches: [main]
permissions:
contents: read
jobs:
merge-to-v71:
permissions:
contents: write # for Git to git push
pull-requests: write # for Git to create a pull request
runs-on: ubuntu-latest
steps:
- name: Check out GEDCOM
uses: actions/checkout@v4
- name: Set git config
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
git config -l
- name: Check for diffs
id: diff
run: |
git fetch origin
git diff --quiet origin/main..origin/v7.1 || echo "::set-output name=status::changes"
- name: Create Pull Request
if: steps.diff.outputs.status == 'changes'
run: |
git checkout -b merge-main-into-v7.1
git push -f --set-upstream origin merge-main-into-v7.1
if ! gh pr list | grep -q "merge-main-into-v7.1"; then
gh pr create -B v7.1 -H merge-main-into-v7.1 --title 'Merge main into v7.1' --body $'Copy changes from main to v7.1\nThis PR is auto-generated by [gh pr create].' --label 'automated pr' --repo ${{ github.repository }}
fi
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}