notice_generation.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: generate_notices
  2. on:
  3. pull_request:
  4. paths:
  5. - '.github/workflows/notice_generation.yml'
  6. - '.github/actions/notices_generation**'
  7. schedule:
  8. # Run every day at 2am (PST) - cron uses UTC times
  9. - cron: '0 10 * * *'
  10. jobs:
  11. generate_a_notice:
  12. # Don't run on private repo.
  13. if: github.repository == 'Firebase/firebase-ios-sdk'
  14. runs-on: macos-14
  15. name: Generate NOTICES
  16. env:
  17. # The path of NOTICES based on the root dir of repo."
  18. NOTICES_PATH: "CoreOnly/NOTICES"
  19. steps:
  20. - uses: actions/checkout@v4
  21. - name: Get all pod names
  22. run: |
  23. cd "${GITHUB_WORKSPACE}/ReleaseTooling/"
  24. swift run manifest --output-file-path ./output.txt --for-notices-generation
  25. PODS=`cat ./output.txt`
  26. echo "PODS=${PODS}" >> $GITHUB_ENV
  27. echo "NOTICES_PATH=${GITHUB_WORKSPACE}/${NOTICES_PATH}" >> $GITHUB_ENV
  28. - name: Create a local specs repo
  29. run: |
  30. cd "${GITHUB_WORKSPACE}/ReleaseTooling/"
  31. swift run podspecs-tester --git-root "${GITHUB_WORKSPACE}"
  32. - name: Create a NOTICES file
  33. id: notices
  34. uses: ./.github/actions/notices_generation/
  35. with:
  36. pods: ${{ env.PODS }}
  37. sources: "https://github.com/firebase/SpecsTesting,https://github.com/firebase/SpecsStaging,https://cdn.cocoapods.org"
  38. # This should match the highest minimum supported iOS version.
  39. min-ios-version: "15.0"
  40. search-local-pod-version: true
  41. notices-path: ${{ env.NOTICES_PATH }}
  42. - name: Create a pull request
  43. run: |
  44. RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
  45. gem install octokit
  46. ruby scripts/create_pull_request.rb \
  47. --repo-root ${GITHUB_WORKSPACE} \
  48. --repo-token ${{ secrets.GITHUB_TOKEN }} \
  49. --target-path ${{ env.NOTICES_PATH }} \
  50. --pr-title "NOTICES Change" \
  51. --pr-body "NOTICES Change is detected in [this GitHub Actions Run](${RUN_URL})." \
  52. --commit-comment "NOTICES change."
  53. shell: bash