forked from TeamHG-Memex/html-text
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (107 loc) · 3.98 KB
/
autonomous-progress.yml
File metadata and controls
120 lines (107 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Autonomous Progress (Org Sweep)
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
inputs:
workflow_file:
description: 'Workflow file to dispatch to repos (must exist in target repos)'
required: false
default: 'auto-complete-cicd-review.yml'
type: string
ref:
description: 'Git ref to run workflow from'
required: false
default: 'main'
type: string
all_accounts:
description: 'Dispatch to all accounts (P4X-ng, HyperionGray, TeamHG-Memex, hyp3ri0n-ng)'
required: false
default: true
type: boolean
include_archived:
description: 'Include archived repositories'
required: false
default: false
type: boolean
jobs:
dispatch:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install requests
- name: Dispatch workflow across repositories
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
DEFAULT_WORKFLOW_FILE: 'auto-complete-cicd-review.yml'
DEFAULT_REF: 'main'
run: |
WORKFLOW_FILE="${DEFAULT_WORKFLOW_FILE}"
REF="${DEFAULT_REF}"
ALL_ACCOUNTS="true"
INCLUDE_ARCHIVED="false"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
INCLUDE_ARCHIVED="${{ github.event.inputs.include_archived }}"
fi
if [ -z "${INCLUDE_ARCHIVED}" ]; then
INCLUDE_ARCHIVED="false"
fi
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
WORKFLOW_FILE="${{ github.event.inputs.workflow_file }}"
REF="${{ github.event.inputs.ref }}"
ALL_ACCOUNTS="${{ github.event.inputs.all_accounts }}"
fi
if [ -z "${WORKFLOW_FILE}" ]; then
WORKFLOW_FILE="${DEFAULT_WORKFLOW_FILE}"
fi
if [ -z "${REF}" ]; then
REF="${DEFAULT_REF}"
fi
if [ -z "${ALL_ACCOUNTS}" ]; then
ALL_ACCOUNTS="true"
fi
echo "Dispatching workflow: ${WORKFLOW_FILE}"
echo "Ref: ${REF}"
ARCHIVED_FLAG=""
if [ "${INCLUDE_ARCHIVED}" = "true" ]; then
ARCHIVED_FLAG="--include-archived"
fi
if [ "${ALL_ACCOUNTS}" = "true" ] || [ "${{ github.event_name }}" = "schedule" ]; then
python trigger_workflow_all_repos.py \
"${WORKFLOW_FILE}" \
--all-accounts \
--ref "${REF}" \
${ARCHIVED_FLAG} \
--delay 1.5
else
python trigger_workflow_all_repos.py \
P4X-ng \
"${WORKFLOW_FILE}" \
--ref "${REF}" \
${ARCHIVED_FLAG} \
--delay 1.5
fi
- name: Summary
if: always()
run: |
echo "## Autonomous Progress Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Trigger:** ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "**Workflow file:** ${{ github.event.inputs.workflow_file }}" >> $GITHUB_STEP_SUMMARY
echo "**Ref:** ${{ github.event.inputs.ref }}" >> $GITHUB_STEP_SUMMARY
echo "**All accounts:** ${{ github.event.inputs.all_accounts }}" >> $GITHUB_STEP_SUMMARY
echo "**Include archived:** ${{ github.event.inputs.include_archived }}" >> $GITHUB_STEP_SUMMARY
else
echo "**Workflow file:** auto-complete-cicd-review.yml" >> $GITHUB_STEP_SUMMARY
echo "**Ref:** main" >> $GITHUB_STEP_SUMMARY
echo "**All accounts:** true" >> $GITHUB_STEP_SUMMARY
echo "**Include archived:** false" >> $GITHUB_STEP_SUMMARY
fi