From 63a512a9104ad334da6ec6332a327aecfa1ea1df Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Tue, 5 May 2020 03:01:37 -0700 Subject: [PATCH] Github Action to create PR for Podfile.lock (#1097) Summary: This PR adds GH action to create PR with the updated Podfile.lock when a new tag is released. ## Changelog - Add GH action to automatically create PR with updated Podfile.lock. Pull Request resolved: https://github.com/facebook/flipper/pull/1097 Test Plan: I was not able to test it on a release of tag. But I tested it by triggering the workflow on a push to the branch. It created a PR like [this](https://github.com/facebook/flipper/pull/1110). Reviewed By: jknoxville Differential Revision: D21381996 Pulled By: priteshrnandgaonkar fbshipit-source-id: 2dffa0f71f7e211541728acb06aea5763ae53f47 --- .github/workflows/publish-pods.yml | 71 +++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-pods.yml b/.github/workflows/publish-pods.yml index 70394523c..c209a2d11 100644 --- a/.github/workflows/publish-pods.yml +++ b/.github/workflows/publish-pods.yml @@ -1,7 +1,7 @@ name: Publish Pods on: push: - tags: + tags: - v* jobs: @@ -39,3 +39,72 @@ jobs: for i in {1..5}; do pod trunk push FlipperKit.podspec --use-libraries --allow-warnings --verbose --skip-import-validation && break || sleep 20; done env: COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + + create_pr: + needs: publish_flipperkit_pod + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Dependencies + run: pod repo update + + - name: Pod Version + run: pod --version + + - name: Update Sample's Podfile.lock + run: | + cd iOS/Sample/ + pod update + ls + + - name: Update SampleSwift's Podfile.lock + run: | + cd iOS/SampleSwift/ + pod update + ls + + - name: Update Tutorial's Podfile.lock + run: | + cd iOS/Tutorial/ + pod update + ls + + # Followed this https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#creating-pull-requests-on-tag-push + - name: Create a temporary tag branch + run: | + git config --global user.name 'GitHub' + git config --global user.email 'noreply@github.com' + git checkout -b temp-${GITHUB_REF:10} + git push --set-upstream origin temp-${GITHUB_REF:10} + + - name: Git status + run: | + git status + + - name: Git diff + run: | + git diff + + - name: Git branch + run: | + git branch + + - name: Create PR to Update Podfile.lock + uses: peter-evans/create-pull-request@v2 + with: + title: 'Automated: Update Podfile.lock' + body: | + This is an automated PR to update the Podfile.lock. + - Make sure that the Podfile.lock contains latest FlipperKit and Flipper pod versions. + - Also make sure that all the dependencies are updated to the latest one. + - This is auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request) + base: 'master' + branch-suffix: short-commit-hash + labels: automated pr + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Delete tag branch + run: | + git push --delete origin temp-${GITHUB_REF:10}