notice_generation.yml 2.1 KB

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