Add workflow to generate and commit OSS licenses
This commit is contained in:
45
.github/workflows/pull_request.yml
vendored
45
.github/workflows/pull_request.yml
vendored
@@ -4,8 +4,51 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
generate_licenses:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Flutter
|
||||
uses: subosito/flutter-action@v1.5.3
|
||||
with:
|
||||
flutter-version: '3.32.1'
|
||||
channel: "stable"
|
||||
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Generate oss_licenses.dart
|
||||
run: flutter pub run flutter_oss_licenses:generate -o lib/presentation/views/about/licenses/oss_licenses.dart
|
||||
|
||||
- name: Escape dollar signs in licenses
|
||||
run: |
|
||||
sed -i 's/\$/\\$/g' lib/presentation/views/about/licenses/oss_licenses.dart
|
||||
|
||||
- name: Check for changes
|
||||
id: check_changes
|
||||
run: |
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
echo "changes_detected=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changes_detected=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Commit Changes
|
||||
if: steps.check_changes.outputs.changes_detected == 'true'
|
||||
run: |
|
||||
git config --global user.name "GitHub Actions"
|
||||
git config --global user.email "actions@github.com"
|
||||
git add .
|
||||
git commit -m "Actions: Licenses updated [skip ci]"
|
||||
git push
|
||||
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
needs: generate_licenses
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -37,4 +80,4 @@ jobs:
|
||||
run: flutter pub get
|
||||
|
||||
- name: Run Tests
|
||||
run: flutter test
|
||||
run: flutter test
|
||||
|
||||
Reference in New Issue
Block a user