-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Update Swift Settings Workflow
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Update Swift Settings | ||
|
||
on: | ||
push: | ||
schedule: | ||
- cron: '0 0 * * *' # Run daily at midnight UTC | ||
workflow_dispatch: # Allow manual triggering | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
update-settings: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Swift | ||
uses: swift-actions/setup-swift@v2 | ||
|
||
- name: Install Mint | ||
run: | | ||
git clone https://github.com/yonaskolb/Mint.git | ||
cd Mint | ||
swift build -c release | ||
mkdir -p .mint/bin | ||
cp .build/release/mint .mint/bin/ | ||
echo "MINT_CMD=$GITHUB_WORKSPACE/Mint/.mint/bin/mint" >> $GITHUB_ENV | ||
- name: Cache Mint packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: .mint | ||
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }} | ||
restore-keys: | | ||
${{ runner.os }}-mint- | ||
|
||
|
||
- name: Clean SwiftSettings directory | ||
run: | | ||
rm -rf Sources/PackageDSL/SwiftSettings/* | ||
mkdir -p Sources/PackageDSL/SwiftSettings/UnsafeFlags | ||
mkdir -p Sources/PackageDSL/SwiftSettings/FeatureFlags | ||
- name: Update Unsafe Flags | ||
run: | | ||
bash Scripts/soundness/unsafeflags.sh Sources/PackageDSL/SwiftSettings/UnsafeFlags | ||
- name: Update Feature Flags | ||
run: | | ||
bash Scripts/soundness/features.sh Sources/PackageDSL/SwiftSettings/FeatureFlags | ||
- name: Update Documentation | ||
run: bash Scripts/soundness/docc.sh | ||
|
||
- name: Run Linter | ||
run: bash Scripts/soundness/lint.sh | ||
|
||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "changes=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "changes=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Create Pull Request | ||
if: steps.check_changes.outputs.changes == 'true' | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: 'chore: Update Swift Settings' | ||
title: 'Update Swift Settings' | ||
body: | | ||
This PR updates the Swift settings including: | ||
- Unsafe flags | ||
- Feature flags | ||
- Documentation | ||
This is an automated PR created by the update-settings workflow. | ||
branch: update-swift-settings-${{ github.run_number }}-${{ github.run_attempt }} | ||
base: main | ||
delete-branch: true |