You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Remove the "#" sign from the beginning of the line below to get automated builds on push (code changes in your repository)
7
-
#push:
8
-
9
-
# Automated builds now include automatic certificate update - the nuke certs part of that process could
10
-
# affect other OS apps if run simultaneously.
11
-
# Each OS needs a time of day distinct from other apps, LoopCaregiver uses 13 every Wed and 11 every 1st of month
12
5
schedule:
13
-
#avoid starting an action at xx:00 when GitHub resources are more likely to be impacted
14
-
- cron: "33 13 * * 3"# Checks for updates at 09:33 UTC every Wednesday
15
-
- cron: "33 11 1 * *"#Builds the app on the 1st of every month at 07:33 UTC
6
+
#Check for updates every Sunday
7
+
# Later logic builds if there are updates or if it is the 2nd Sunday of the month
8
+
- cron: "33 13 * * 0"#Sunday at UTC 13:33
16
9
17
10
env:
11
+
GH_PAT: ${{ secrets.GH_PAT }}
18
12
UPSTREAM_REPO: LoopKit/LoopCaregiver
19
13
UPSTREAM_BRANCH: ${{ github.ref_name }} # branch on upstream repository to sync from (replace with specific branch name if needed)
20
-
TARGET_BRANCH: ${{ github.ref_name }} # target branch on fork to be kept in sync, and target branch on upstream to be kept alive (replace with specific branch name if needed)
21
-
ALIVE_BRANCH_MAIN: alive-main # Will not be created: LoopCaregiver has no main branch
22
-
ALIVE_BRANCH_DEV: alive-dev
14
+
TARGET_BRANCH: ${{ github.ref_name }} # target branch on fork to be kept in sync
23
15
24
16
jobs:
25
-
# Checks if Distribution certificate is present and valid, optionally nukes and
26
-
# creates new certs if the repository variable ENABLE_NUKE_CERTS == 'true'
27
-
check_certs:
28
-
name: Check certificates
29
-
uses: ./.github/workflows/create_certs.yml
30
-
secrets: inherit
31
-
32
-
# Checks if GH_PAT holds workflow permissions
33
-
# Checks for existence of alive branch; if non-existent creates it
echo "::error::Unable to connect to GitHub using the GH_PAT secret. Verify that it is set correctly (including the 'ghp_' or 'github_pat_' prefix) and try again."
62
+
else
63
+
echo "::error::Unable to connect to GitHub using the GH_PAT secret. Verify that the token exists and has not expired at https://github.com/settings/tokens. If necessary, regenerate or create a new token (and update the secret), then try again."
64
+
fi
65
+
elif [[ $scopes =~ workflow ]]; then
66
+
echo "The GH_PAT secret has repo and workflow permissions."
67
+
echo "has_permission=true" >> $GITHUB_OUTPUT
68
+
elif [[ $scopes =~ repo ]]; then
69
+
echo "The GH_PAT secret has repo (but not workflow) permissions."
70
+
elif [ $provides_scopes ]; then
71
+
failed=true
72
+
if [ -z "$scopes" ]; then
73
+
echo "The GH_PAT secret is valid and can be used to connect to GitHub, but it does not provide any permission scopes."
74
+
else
75
+
echo "The GH_PAT secret is valid and can be used to connect to GitHub, but it only provides the following permission scopes: $scopes"
76
+
fi
77
+
echo "::error::The GH_PAT secret is lacking at least the 'repo' permission scope required to access the Match-Secrets repository. Update the token permissions at https://github.com/settings/tokens (to include the 'repo' and 'workflow' scopes) and try again."
78
+
else
79
+
echo "The GH_PAT secret is valid and can be used to connect to GitHub, but it does not provide inspectable scopes. Assuming that the 'repo' and 'workflow' permission scopes required to access the Match-Secrets repository and perform automations are present."
echo "You have not yet configured the scheduled sync and build for LoopCaregiver's browser build." >> $GITHUB_STEP_SUMMARY
189
135
echo "Synchronizing your fork of <code>LoopCaregiver</code> with the upstream repository <code>LoopKit/LoopCaregiver</code> will be skipped." >> $GITHUB_STEP_SUMMARY
190
136
echo "If you want to enable automatic builds and updates for your LoopCaregiver, please follow the instructions \
191
137
under the following path <code>LoopCaregiver/fastlane/testflight.md</code>." >> $GITHUB_STEP_SUMMARY
192
138
139
+
# Set a logic flag if this is the second instance of this day-of-week in this month
140
+
- name: Check if this is the second time this day-of-week happens this month
| #runs if started manually, or if sync schedule is set and enabled and scheduled on the first Saturday each month, or if sync schedule is set and enabled and new commits were found
172
+
| #builds with manual start; if scheduled: once a month or when new commits are found
0 commit comments