Create close-pr.yaml #13
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: Create PR | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create-pr: | |
name: Create Pull Request | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo 'GitHub context' | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: 'Setup git config' | |
run: | | |
git config user.name "dotCMS-Machine-User" | |
git config user.email "[email protected]" | |
- name: 'Update config' | |
id: update-config | |
run: | | |
# Create a release branch for versioning updates | |
# AUXILIARY_BRANCH=version-update-${{ github.run_id }} | |
# git checkout -b $AUXILIARY_BRANCH | |
echo "Hello $(date)" > hello.conf | |
# Commit version changes | |
git add . | |
git status | |
git commit --allow-empty -a -m "⚽️ Updating configuration..." | |
# git push origin $AUXILIARY_BRANCH | |
# echo "auxiliary-branch=$AUXILIARY_BRANCH" >> "$GITHUB_OUTPUT" | |
- name: 'Create Pull Request' | |
id: create-pull-request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: version-update-${{ github.run_id }} | |
base: main | |
title: 'Auto-generated PR: Update configuration files' | |
body: 'This PR was created automatically to update the configuration files.' | |
draft: false | |
labels: | | |
sdk libs | |
automated pr | |
- name: 'Enable Pull Request Automerge' | |
if: steps.create-pull-request.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }} | |
merge-method: squash |