Sync Branches #5260
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: Sync Branches | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */2 * * *' | |
jobs: | |
run: | |
runs-on: ubuntu-20.04 | |
if: startsWith( github.repository, 'elementor/' ) | |
steps: | |
- name: Checkout master branch | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.MAINTAIN_TOKEN }} | |
ref: master | |
- name: Install Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Sync developer-edition branch | |
env: | |
MAINTAIN_EMAIL: ${{ secrets.MAINTAIN_EMAIL }} | |
MAINTAIN_USERNAME: ${{ secrets.MAINTAIN_USERNAME }} | |
run: | | |
bash "${GITHUB_WORKSPACE}/.github/scripts/sync-developer-edition-branch.sh" | |
- name: Sync feature branches into developer-edition branch | |
if: ${{ false }} # Disabled for now | |
env: | |
TOKEN: ${{ secrets.MAINTAIN_TOKEN }} | |
REPOSITORY: ${{ github.repository }} | |
run: | | |
npm install --no-package-lock --no-save @octokit/core@3.3.1 | |
node "${GITHUB_WORKSPACE}/.github/scripts/sync-features-branch-to-developer-branch.js" | |
- name: Notify slack on failure | |
if: failure() | |
env: | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
SLACK_CHANNEL: ${{ secrets.SLACK_SYNC_CHANNEL }} | |
SLACK_BOT_NAME: ElementorBot | |
run: | | |
MESSAGE_TEXT="@channel Repo: *$GITHUB_REPOSITORY* Workflow: *$GITHUB_WORKFLOW* is FAILED - <$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID|link>" | |
curl -X POST "https://slack.com/api/chat.postMessage" -d "username=${SLACK_BOT_NAME}&token=${SLACK_TOKEN}&channel=${SLACK_CHANNEL}&text=${MESSAGE_TEXT}&link_names=true" |