notice_generation.yml 2.1 KB

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