From 73f382706ed07f29b97b055031e69e7beb6c1795 Mon Sep 17 00:00:00 2001 From: kendal Date: Wed, 22 May 2024 16:54:54 -0700 Subject: [PATCH] Support token authentication --- .github/workflows/cron-sync-bcny-forks.yml | 18 ++++++++++++++++++ action.yml | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/.github/workflows/cron-sync-bcny-forks.yml b/.github/workflows/cron-sync-bcny-forks.yml index 026f0f4..6a190d7 100644 --- a/.github/workflows/cron-sync-bcny-forks.yml +++ b/.github/workflows/cron-sync-bcny-forks.yml @@ -8,8 +8,21 @@ on: workflow_dispatch: jobs: + token: + runs-on: ubuntu-latest + outputs: + token: ${{ steps.token.outputs.token }} + steps: + - uses: actions/create-github-app-token@v1 + id: token + with: + app-id: ${{ secrets.FORK_SYNCER_APP_ID }} + private-key: ${{ secrets.FORK_SYNCER_PRIVATE_KEY }} + owner: thebrowsercompany + repositories: firebase-cpp-sdk sync_analytics_swift: + needs: [token] name: "Sync thebrowsercompany/analytics-swift" runs-on: ubuntu-latest steps: @@ -19,8 +32,10 @@ jobs: fork_branch: develop upstream_repo: segmentio/analytics-swift upstream_branch: main + token: ${{ needs.token.outputs.token }} sync_firebase_cpp_sdk: + needs: [token] name: "Sync thebrowsercompany/firebase-cpp-sdk" runs-on: ubuntu-latest steps: @@ -30,8 +45,10 @@ jobs: fork_branch: compnerd/swift upstream_repo: firebase/firebase-cpp-sdk upstream_branch: main + token: ${{ needs.token.outputs.token }} sync_swift_eventsource: + needs: [token] name: "Sync thebrowsercompany/swift-eventsource" runs-on: ubuntu-latest steps: @@ -41,4 +58,5 @@ jobs: fork_branch: main-bcny upstream_repo: launchdarkly/swift-eventsource upstream_branch: main + token: ${{ needs.token.outputs.token }} diff --git a/action.yml b/action.yml index 0c6dffc..fefa891 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,10 @@ inputs: required: false default: false + token: + description: Authentication token to use for Git commands + required: false + runs: using: composite steps: @@ -39,6 +43,7 @@ runs: # Fetch all commits from the fork to prevent arbitrary merge conflicts. fetch-depth: 0 path: ${{ github.workspace }}/fork + token: ${{ inputs.token || github.token }} - name: Rebase onto upstream shell: pwsh