Skip to content

add/remove (#18)

add/remove (#18) #9

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 "")
echo "ADDED_FILES=$ADDED_FILES" >> $GITHUB_ENV
echo "REMOVED_FILES=$REMOVED_FILES" >> $GITHUB_ENV
- name: Push changes and create pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADDED_FILES: ${{ env.ADDED_FILES }}
REMOVED_FILES: ${{ env.REMOVED_FILES }}
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
Relayers added:
${ADDED_FILES}
Relayers removed:
${REMOVED_FILES}
"