notice_generation.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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' && github.event_name == 'schedule'
  14. runs-on: macos-12
  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@v3
  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. min-ios-version: "13.0"
  39. search-local-pod-version: true
  40. notices-path: ${{ env.NOTICES_PATH }}
  41. - name: Create a pull request
  42. run: |
  43. RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
  44. gem install octokit
  45. ruby scripts/create_pull_request.rb \
  46. --repo-root ${GITHUB_WORKSPACE} \
  47. --repo-token ${{ secrets.GITHUB_TOKEN }} \
  48. --target-path ${{ env.NOTICES_PATH }} \
  49. --pr-title "NOTICES Change" \
  50. --pr-body "NOTICES Change is detected in [this GitHub Actions Run](${RUN_URL})." \
  51. --commit-comment "NOTICES change."
  52. shell: bash