Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #22 from futureleadersupc/chore/setup-sync
Browse files Browse the repository at this point in the history
chore(sync): initial setup of fake API file sync
  • Loading branch information
dalbitresb12 authored May 18, 2022
2 parents 3fa027c + c391bf6 commit 0a26fa8
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 26 deletions.
13 changes: 13 additions & 0 deletions .github/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
futureleadersupc/waw-backend-json:
- source: server/db.json
dest: db.json
- source: server/routes.json
dest: routes.json
- source: .github/workflows/sync.yml
dest: .github/workflows/sync.yml

futureleadersupc/waw-frontend-angular:
- source: server/
dest: server/
- source: .github/workflows/sync.yml
dest: .github/workflows/sync.yml
26 changes: 0 additions & 26 deletions .github/workflows/json-server.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: sync

on:
push:
branches:
- main
paths:
- server/*
- .github/workflows/sync.yml

jobs:
file-sync:
name: 'run file sync'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.sync-output.outputs.pull_request_urls }}
steps:
- name: Checkout current repository
uses: actions/checkout@v3
- name: Sync files to all repositories
id: sync-output
uses: BetaHuhn/repo-file-sync-action@v1
with:
GH_PAT: ${{ secrets.BOT_PAT }}
PR_LABELS: |
chore
scope: sync
ASSIGNEES: dalbitresb12-bot
REVIEWERS: ${{ github.actor }}
BRANCH_PREFIX: chore/file-sync
COMMIT_PREFIX: 'chore(sync): '
COMMIT_EACH_FILE: false
enable-automerge:
name: 'enable auto-merge'
needs: [file-sync]
runs-on: ubuntu-latest
strategy:
matrix:
url: ${{ fromJson(needs.file-sync.outputs.matrix) }}
steps:
- name: Extract pull request info
id: pr-info
env:
CURRENT_URL: ${{ matrix.url }}
shell: python
run: |
import os, re
url = os.environ["CURRENT_URL"]
match = re.fullmatch("^https:\/\/github.com\/(.+)\/(.+)\/pull\/(\d+)$", url)
if (match is None):
print(f"Unable to find a match in {url}")
sys.exit(1)
print(f"::set-output name=repository::{match[1]}/{match[2]}")
print(f"::set-output name=number::{match[3]}")
- name: Enable auto-merge for created pull requests
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.BOT_PAT }}
repository: ${{ steps.pr-info.outputs.repository }}
pull-request-number: ${{ steps.pr-info.outputs.number }}
merge-method: merge

0 comments on commit 0a26fa8

Please sign in to comment.