Skip to content

Commit

Permalink
Adding Update Swift Settings Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion committed Feb 4, 2025
1 parent e858619 commit 3866dfb
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/update-settings.yml
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

0 comments on commit 3866dfb

Please sign in to comment.