Skip to content

Merge pull request #9 from RedEyeMods/updated/template/action-template #11

Merge pull request #9 from RedEyeMods/updated/template/action-template

Merge pull request #9 from RedEyeMods/updated/template/action-template #11

name: Settings Sync
on:
workflow_dispatch:
push:
branches:
- '**'
jobs:
get-template-repo:
name: Parent Template Repository
runs-on: ubuntu-latest
outputs:
template_repository: ${{ steps.org-grab.outputs.result }}
steps:
- name: Get Organization Data
id: org-grab
uses: actions/github-script@v7
with:
github-token: ${{ secrets.ORG_PAT }}
script: |
const fs = require('fs');
var request = await github.rest.repos.get({
...context.repo
});
if (request.status != 200)
throw new Exception('Bad API response: ' + request.status);
return request.data.template_repository == undefined ? {} : request.data.template_repository;
run-init:
name: Repository Settings Synchronization
needs: get-template-repo
if: ${{ fromJson(needs.get-template-repo.outputs.template_repository).full_name != '' }}
runs-on: ubuntu-latest
env:
CUR_REPO: ${{ github.repository }}
SOURCE_REPO: ${{ fromJson(needs.get-template-repo.outputs.template_repository).full_name }}
steps:
- name: Copy On Rulesets
uses: RedEyeMods/[email protected]
with:
token: ${{ secrets.ORG_PAT }}
source-repo: ${{ env.SOURCE_REPO }}
regex-filter: '✓+.*'
ruleset-enabled: true
overwrite: true
- name: Copy Off Rulesets
uses: RedEyeMods/[email protected]
with:
token: ${{ secrets.ORG_PAT }}
source-repo: ${{ env.SOURCE_REPO }}
regex-filter: '✗+.*'
ruleset-enabled: false
overwrite: true
- name: Copy Labels
uses: RedEyeMods/[email protected]
with:
token: ${{ secrets.ORG_PAT }}
source-repo: ${{ env.SOURCE_REPO }}
- name: Copy Repo Settings
uses: RedEyeMods/[email protected]
with:
token: ${{ secrets.ORG_PAT }}
source-repo: ${{ env.SOURCE_REPO }}
one-time:
name: Execute One Time
runs-on: ubuntu-latest
steps:
- name: Disable Workflow
run: |
gh workflow disable -R $GITHUB_REPOSITORY "${{ github.workflow }}"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}