feat: Changed the installation method of flutterfire_cli
in the post-clone script for Xcode Cloud
#655
Workflow file for this run
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
name: Pod install for Dependabot | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize] | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pod_install: | |
if: startsWith(github.head_ref, 'dependabot/pub/') | |
runs-on: macos-latest | |
timeout-minutes: 10 | |
env: | |
head_ref: ${{ github.head_ref }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Retrieve package | |
run: | | |
PACKAGE=$(echo "${{ env.head_ref }}" | cut -d "/" -f 4) | |
echo "directory=packages/$PACKAGE/ios" >> "$GITHUB_ENV" | |
- name: Check if directory exists | |
run: | | |
if [ ! -d "${{ github.workspace }}/${{ env.directory }}" ]; then | |
echo "::notice::iOS directory not found" | |
echo "directory_exists=false" >> "$GITHUB_ENV" | |
fi | |
- name: Parse Flutter version | |
if: env.directory_exists == 'true' | |
id: fvm | |
uses: kuhnroyal/flutter-fvm-config-action@v2 | |
- name: Install Flutter | |
if: env.directory_exists == 'true' | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ steps.fvm.outputs.FLUTTER_VERSION }} | |
channel: ${{ steps.fvm.outputs.FLUTTER_CHANNEL }} | |
cache: true | |
- name: Flutter pub get | |
if: env.directory_exists == 'true' | |
run: | | |
cd ${{ env.directory }} | |
flutter pub get | |
- name: Install pods | |
if: env.directory_exists == 'true' | |
run: pod install --project-directory=${{ env.directory }} | |
- name: Check diff | |
if: env.directory_exists == 'true' | |
run: | | |
diff_count=$(git diff | wc -l) | |
if [ "$diff_count" -ne 0 ]; then | |
echo "has_diff=true" >> "$GITHUB_ENV" | |
else | |
echo "has_diff=false" >> "$GITHUB_ENV" | |
fi | |
- name: Git config | |
if: env.directory_exists == 'true' && env.has_diff == 'true' | |
id: git_config | |
run: | | |
git remote set-url origin "https://github-actions:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}" | |
git config --global user.name "${GITHUB_ACTOR}" | |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: Generate GiHub App token | |
if: steps.git_config.conclusion == 'success' | |
id: generate_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app_id: ${{ vars.PR_WRITER_APP_ID }} | |
private_key: ${{ secrets.PR_WRITER_PRIVATE_KEY }} | |
- name: Commit and Push | |
if: steps.generate_token.conclusion == 'success' | |
id: commit | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
git fetch origin ${{ env.head_ref }} | |
git switch ${{ env.head_ref }} | |
git add . | |
git commit -m "build(deps): install pods" | |
git push origin ${{ env.head_ref }} | |
- name: Commnet to PR | |
if: steps.commit.conclusion == 'success' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'I did a pod install and found a difference in the podfile.lock, so I committed it!' | |
}) | |
- name: Revoke GitHub Apps token | |
if: steps.generate_token.conclusion == 'success' | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
run: | | |
curl --location --silent --request DELETE \ | |
--url "${GITHUB_API_URL}/installation/token" \ | |
--header "Accept: application/vnd.github+json" \ | |
--header "X-GitHub-Api-Version: 2022-11-28" \ | |
--header "Authorization: Bearer ${GITHUB_TOKEN}" |