Add sync action (#2)

* Add workflow sync

* Add sync action
This commit is contained in:
Pavel Popov 2022-02-22 00:35:48 +03:00 committed by GitHub
parent 45d7f31a6c
commit afcb0b1ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 81 additions and 3 deletions

View File

@ -4,6 +4,11 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
- main
push:
branches:
- master
- main
jobs: jobs:
lint: lint:

68
.github/workflows/sync.yml vendored Normal file
View File

@ -0,0 +1,68 @@
name: Vality workflows sync
on:
push:
branches:
- master
- main
env:
REPO_LIMIT: 1000
jobs:
workflows-sync:
name: Sync files in ${{ matrix.language }} repositories
runs-on: ubuntu-latest
strategy:
matrix:
include:
- language: thrift
file_patterns: |
^LICENSE$
workflow_patterns: |
^basic-linters\.yml$
- language: erlang
file_patterns: |
^LICENSE$
workflow_patterns: |
^basic-linters\.yml$
- language: java
file_patterns: |
^LICENSE$
workflow_patterns: |
^basic-linters\.yml$
steps:
- name: 📤 Get a list of ${{ matrix.language }} repositories
run: |
REPOSITORIES=$(gh repo list \
$OWNER \
--source \
--no-archived \
-L $REPO_LIMIT \
- l ${{ matrix.language }} \
--json name,owner \
-q '.[] | [.owner.login, .name] | join("/")')
echo "REPOSITORIES<<EOF" >> $GITHUB_ENV
echo "$REPOSITORIES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
- name: 🔄 Sync main files
uses: adrianjost/files-sync-action@v1.5.0
with:
TARGET_REPOS: ${{ env.REPOSITORIES }}
FILE_PATTERNS: ${{ matrix.file_patterns }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
- name: 🔄 Sync workflow files
uses: adrianjost/files-sync-action@v1.5.0
with:
TARGET_REPOS: ${{ env.REPOSITORIES }}
FILE_PATTERNS: ${{ matrix.workflow_patterns }}
SRC_ROOT: "/workflow-templates/"
TARGET_ROOT: "/.github/workflows/"
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}

View File

@ -174,4 +174,3 @@
of your accepting any such warranty or additional liability. of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS

View File

@ -3,7 +3,8 @@ name: Vality auto-tags
on: on:
push: push:
branches: branches:
- $default-branch - master
- main
jobs: jobs:
lint: lint:

View File

@ -3,7 +3,12 @@ name: Vality basic linters
on: on:
pull_request: pull_request:
branches: branches:
- $default-branch - master
- main
push:
branches:
- master
- main
jobs: jobs:
lint: lint: