From c41eb8083989c9b6f436807f98991ff3cb4f0752 Mon Sep 17 00:00:00 2001 From: Nonumpa Date: Wed, 11 Dec 2024 16:55:11 +0800 Subject: [PATCH] fix: Failed to add secret: Secret names must not start with GITHUB_. --- .env.sample | 6 +++--- .github/workflows/takedown.yml | 6 +++--- src/githubPR.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.env.sample b/.env.sample index 83dcdf6..ae8bfff 100644 --- a/.env.sample +++ b/.env.sample @@ -3,11 +3,11 @@ GEMINI_API_KEY= # https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/authenticating-to-the-github-api#authenticating-arc-with-a-github-app # See the step2 in the above link -GITHUB_APP_ID= +GITHUBAPP_ID= # See the step3 in the link, and make sure to convert to base64: `base64 -i your_private_key_file > key.base64` -GITHUB_APP_PRIVATE_KEY_BASE64= +GITHUBAPP_PRIVATE_KEY_BASE64= # Step5 in the link -GITHUB_APP_INSTALLATION_ID= +GITHUBAPP_INSTALLATION_ID= # To generate takedown document(reply url) for moderators to review COFACTS_URL=https://dev.cofacts.tw diff --git a/.github/workflows/takedown.yml b/.github/workflows/takedown.yml index 3d4ad65..07a1d69 100644 --- a/.github/workflows/takedown.yml +++ b/.github/workflows/takedown.yml @@ -20,9 +20,9 @@ jobs: - name: Create takedown PR env: GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} - GITHUB_APP_PRIVATE_KEY_BASE64: ${{ secrets.GITHUB_APP_PRIVATE_KEY_BASE64 }} - GITHUB_APP_ID: ${{ secrets.GITHUB_APP_ID }} - GITHUB_APP_INSTALLATION_ID: ${{ secrets.GITHUB_APP_INSTALLATION_ID }} + GITHUBAPP_PRIVATE_KEY_BASE64: ${{ secrets.GITHUBAPP_PRIVATE_KEY_BASE64 }} + GITHUBAPP_ID: ${{ secrets.GITHUBAPP_ID }} + GITHUBAPP_INSTALLATION_ID: ${{ secrets.GITHUBAPP_INSTALLATION_ID }} COFACTS_URL: ${{ env.COFACTS_URL }} COFACTS_API_URL: ${{ env.COFACTS_API_URL }} REVIEW_REPLY_BEFORE: ${{ env.REVIEW_REPLY_BEFORE }} diff --git a/src/githubPR.js b/src/githubPR.js index 66ab144..ba56f0a 100644 --- a/src/githubPR.js +++ b/src/githubPR.js @@ -10,14 +10,14 @@ const prTargetBranch = 'master'; let cachedOctokit; async function getGithubApp() { if (cachedOctokit) return cachedOctokit; - const appId = process.env.GITHUB_APP_ID; + const appId = process.env.GITHUBAPP_ID; // for easier to read from env, we base64 encode the private key const privateKey = Buffer.from( - process.env.GITHUB_APP_PRIVATE_KEY_BASE64, + process.env.GITHUBAPP_PRIVATE_KEY_BASE64, 'base64' ).toString('utf-8'); - const installationId = process.env.GITHUB_APP_INSTALLATION_ID; + const installationId = process.env.GITHUBAPP_INSTALLATION_ID; const octokit = new Octokit({ authStrategy: createAppAuth,