Skip to content

Test pr body (#10)

Test pr body (#10) #5

name: Merge Configs and Create Pull Request
on:
push:
branches:
- master
paths:
- "configs/**"
workflow_dispatch:
jobs:
merge_configs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
shell: bash
- name: Run merge-configs script
run: yarn merge-configs
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit changes
run: |
git add build/
git commit -m "Auto-generated build file after merging to master"
- name: Get modified config file names
id: get_filenames
run: |
ADDED_FILES=$(git diff --name-only --diff-filter=A HEAD~1 | grep '^configs/' | xargs -n 1 basename -s .json || echo "")
REMOVED_FILES=$(git diff --name-only --diff-filter=D HEAD~1 | grep '^configs/' | xargs -n 1 basename -s .json || echo "")
if [ -n "$ADDED_FILES" ]; then
ADDED_FILE_LIST=$(echo "$ADDED_FILES" | sed 's/^/- **Added:** `\/configs\//;s/$/.json`/' | tr '\n' '\n')
else
ADDED_FILE_LIST=""
fi
if [ -n "$REMOVED_FILES" ]; then
REMOVED_FILE_LIST=$(echo "$REMOVED_FILES" | sed 's/^/- **Removed:** `\/configs\//;s/$/.json`/' | tr '\n' '\n')
else
REMOVED_FILE_LIST=""
fi
echo "ADDED_FILE_LIST=$ADDED_FILE_LIST" >> $GITHUB_ENV
echo "REMOVED_FILE_LIST=$REMOVED_FILE_LIST" >> $GITHUB_ENV
- name: Push changes and create pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="auto-build-$(date +%s)"
git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME"
gh pr create --base master --head "$BRANCH_NAME" --title "Auto-generated build file" --body "
## 🤖 Updated relayer config 🤖
This pull request was automatically created as part of our CI process to update the configuration files in the \`/configs\` directory.
#### 📄 New Configuration Files
$ADDED_FILE_LIST
$REMOVED_FILE_LIST
"