41 lines
1.6 KiB
YAML
41 lines
1.6 KiB
YAML
name: Sync Branches
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 */2 * * *'
|
|
|
|
jobs:
|
|
run:
|
|
runs-on: ubuntu-16.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: 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
|
|
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"
|