|
1 | | -name: Workflows Sync |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - - master |
8 | | - paths: |
9 | | - - 'workflow-templates/**' |
10 | | - - '.github/workflows/workflows-sync.yml' |
11 | | - - 'sync_workflows.py' |
12 | | - workflow_dispatch: |
13 | | - inputs: |
14 | | - all_accounts: |
15 | | - description: 'Sync to all accounts (P4X-ng, HyperionGray, TeamHG-Memex, hyp3ri0n-ng)' |
16 | | - required: false |
17 | | - default: true |
18 | | - type: boolean |
19 | | - include_archived: |
20 | | - description: 'Include archived repositories' |
21 | | - required: false |
22 | | - default: false |
23 | | - type: boolean |
24 | | - schedule: |
25 | | - - cron: '0 6 * * *' |
26 | | - |
27 | | -jobs: |
28 | | - sync: |
29 | | - runs-on: ubuntu-latest |
30 | | - timeout-minutes: 30 |
31 | | - steps: |
32 | | - - name: Checkout |
33 | | - uses: actions/checkout@v4 |
34 | | - |
35 | | - - name: Set up Python |
36 | | - uses: actions/setup-python@v5 |
37 | | - with: |
38 | | - python-version: '3.11' |
39 | | - |
40 | | - - name: Install dependencies |
41 | | - run: pip install requests |
42 | | - |
43 | | - - name: Sync workflow templates to all repositories |
44 | | - env: |
45 | | - GITHUB_TOKEN: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} |
46 | | - run: | |
47 | | - ALL_ACCOUNTS="true" |
48 | | - INCLUDE_ARCHIVED="false" |
49 | | -
|
50 | | - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
51 | | - ALL_ACCOUNTS="${{ github.event.inputs.all_accounts }}" |
52 | | - INCLUDE_ARCHIVED="${{ github.event.inputs.include_archived }}" |
53 | | - fi |
54 | | -
|
55 | | - if [ -z "${ALL_ACCOUNTS}" ]; then |
56 | | - ALL_ACCOUNTS="true" |
57 | | - fi |
58 | | - if [ -z "${INCLUDE_ARCHIVED}" ]; then |
59 | | - INCLUDE_ARCHIVED="false" |
60 | | - fi |
61 | | -
|
62 | | - ARCHIVED_FLAG="" |
63 | | - if [ "${INCLUDE_ARCHIVED}" = "true" ]; then |
64 | | - ARCHIVED_FLAG="--include-archived" |
65 | | - fi |
66 | | -
|
67 | | - if [ "${{ github.event_name }}" = "schedule" ] || [ "${ALL_ACCOUNTS}" = "true" ]; then |
68 | | - echo "Syncing to all accounts: P4X-ng, HyperionGray, TeamHG-Memex, hyp3ri0n-ng" |
69 | | - python sync_workflows.py --all-accounts \ |
70 | | - ${ARCHIVED_FLAG} |
71 | | - else |
72 | | - echo "Syncing to P4X-ng only" |
73 | | - python sync_workflows.py P4X-ng \ |
74 | | - ${ARCHIVED_FLAG} |
75 | | - fi |
76 | | -
|
77 | | - - name: Summary |
78 | | - if: always() |
79 | | - run: | |
80 | | - echo "## Workflow Sync Summary" >> $GITHUB_STEP_SUMMARY |
81 | | - echo "" >> $GITHUB_STEP_SUMMARY |
82 | | - ALL_ACCOUNTS="true" |
83 | | - INCLUDE_ARCHIVED="false" |
84 | | -
|
85 | | - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
86 | | - ALL_ACCOUNTS="${{ github.event.inputs.all_accounts }}" |
87 | | - INCLUDE_ARCHIVED="${{ github.event.inputs.include_archived }}" |
88 | | - fi |
89 | | -
|
90 | | - if [ -z "${ALL_ACCOUNTS}" ]; then |
91 | | - ALL_ACCOUNTS="true" |
92 | | - fi |
93 | | - if [ -z "${INCLUDE_ARCHIVED}" ]; then |
94 | | - INCLUDE_ARCHIVED="false" |
95 | | - fi |
96 | | -
|
97 | | - if [ "${{ github.event_name }}" = "schedule" ] || [ "${ALL_ACCOUNTS}" = "true" ]; then |
98 | | - echo "**Accounts:** P4X-ng, HyperionGray, TeamHG-Memex, hyp3ri0n-ng (all accounts)" >> $GITHUB_STEP_SUMMARY |
99 | | - else |
100 | | - echo "**Accounts:** P4X-ng only" >> $GITHUB_STEP_SUMMARY |
101 | | - fi |
102 | | - echo "**Include archived:** ${INCLUDE_ARCHIVED}" >> $GITHUB_STEP_SUMMARY |
103 | | - echo "**Trigger:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY |
104 | | - echo "" >> $GITHUB_STEP_SUMMARY |
105 | | - echo "See logs above for detailed results." >> $GITHUB_STEP_SUMMARY |
106 | | - echo "" >> $GITHUB_STEP_SUMMARY |
107 | | - echo "> Note: The workflow succeeds as long as P4X-ng syncs successfully." >> $GITHUB_STEP_SUMMARY |
108 | | - echo "> Failures in secondary accounts are expected if GH_PAT lacks access." >> $GITHUB_STEP_SUMMARY |
| 1 | +# Placeholder workflow for workflows-sync.yml |
0 commit comments