From f893c790ca10e07645885833335c8df614805f43 Mon Sep 17 00:00:00 2001 From: rndquu Date: Tue, 12 Mar 2024 13:20:26 +0300 Subject: [PATCH] ci: read cloudflare credentials from action input --- .github/cloudflare-deploy.sh | 2 -- action.yml | 9 ++++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/cloudflare-deploy.sh b/.github/cloudflare-deploy.sh index bd1101b..b2711b2 100755 --- a/.github/cloudflare-deploy.sh +++ b/.github/cloudflare-deploy.sh @@ -13,8 +13,6 @@ echo "Checking if project exists..." # Specifically scoped for public contributors to automatically deploy to our team Cloudflare account -CLOUDFLARE_ACCOUNT_ID="17b9dfa79e16b79dffcb11a66768539c" - # Fetch the list of projects and check if the specific project exists project_exists=$(curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects" \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ diff --git a/action.yml b/action.yml index e9652fe..5625204 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,12 @@ inputs: pull_request_number: description: "Pull request number for posting the deployment link" required: true + cloudflare_account_id: + description: "Cloudflare account id" + required: true + cloudflare_api_token: + description: "Cloudflare API token" + required: true commit_sha: description: "Commit SHA for posting the deployment link" required: false @@ -39,7 +45,8 @@ runs: run: bash ../../_actions/ubiquity/cloudflare-deploy-action/main/.github/cloudflare-deploy.sh "${{ inputs.repository }}" "${{ inputs.production_branch }}" "${{ inputs.output_directory }}" "${{ inputs.current_branch }}" shell: bash env: - CLOUDFLARE_API_TOKEN: "JWo5dPsoyohH5PRu89-RktjCvRN0-ODC6CC9ZBqF" + CLOUDFLARE_ACCOUNT_ID: ${{ inputs.cloudflare_account_id }} + CLOUDFLARE_API_TOKEN: ${{ inputs.cloudflare_api_token }} - name: Post Deployment on Pull Request or Commit shell: bash