Skip to content

Sync ansible-pcp git subtree #1375

Sync ansible-pcp git subtree

Sync ansible-pcp git subtree #1375

Workflow file for this run

---
# yamllint disable rule:line-length
name: Sync ansible-pcp git subtree
on: # yamllint disable-line rule:truthy
schedule:
- cron: "42 1 * * *"
workflow_dispatch:
jobs:
subtree:
runs-on: ubuntu-latest
name: git subtree merge
steps:
- name: checkout repo
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: subtree merge and create PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euxo pipefail
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
BRANCH_NAME="sync-ansible-pcp-subtree-$(date +%Y%m%d-%H%M%S)"
git checkout -b "$BRANCH_NAME"
BEFORE_COMMIT=$(git rev-parse HEAD)
git subtree pull --prefix vendor/github.com/performancecopilot/ansible-pcp https://github.com/performancecopilot/ansible-pcp.git HEAD --squash
if git diff --quiet "$BEFORE_COMMIT" HEAD; then
echo "No changes detected, skipping PR creation"
git checkout main
git branch -D "$BRANCH_NAME"
exit 0
fi
git push origin "$BRANCH_NAME"
PR_URL=$(gh pr create \
--title "Sync ansible-pcp git subtree" \
--body "Automated sync of ansible-pcp git subtree from upstream repository. This PR contains the latest changes from https://github.com/performancecopilot/ansible-pcp.git
You may see a conflict when trying to merge. This is expected as the PR contains a squash commit containing all the changes from the other commits.
To successfully merge this PR, it should be merged via the squash and merge option. Click the dropdown next to the merge button to find the merge options. " \
--base main \
--head "$BRANCH_NAME")
echo "Created PR: $PR_URL"