diff --git a/.github/workflows/update_report_snapshot.yaml b/.github/workflows/update_report_snapshot.yaml index adca44ce..96b8925e 100644 --- a/.github/workflows/update_report_snapshot.yaml +++ b/.github/workflows/update_report_snapshot.yaml @@ -1,6 +1,8 @@ name: Update Report Snapshot on: + push: + branches: [feat/338_WeeklyReportScript] workflow_dispatch: schedule: - cron: '0 0 * * 1' @@ -11,11 +13,14 @@ jobs: steps: - uses: actions/checkout@v3 with: - repository: Magickbase/websites + repository: WhiteMinds/neuron-troubleshooting + ref: feat/338_WeeklyReportScript - name: report:update + env: + GITHUB_TOKEN: ${{ secrets.REPORT_GITHUB_TOKEN }} run: | yarn install - yarn report:update + yarn workspace @magickbase-website/scripts report:update git add packages/scripts/snapshots - name: Set GPG @@ -32,5 +37,5 @@ jobs: title: Update Report Snapshot commit-message: 'feat: update report snapshot' body: 'After this PR is merged, a corresponding discussion will be automatically created' - committer: Chen Yu + committer: WhiteMind branch: update-report-snapshot diff --git a/packages/scripts/.env.example b/packages/scripts/.env.example index 618c6420..2131adfd 100644 --- a/packages/scripts/.env.example +++ b/packages/scripts/.env.example @@ -1,3 +1,3 @@ # For accessing api.github.com # https://docs.github.com/en/rest/overview/authenticating-to-the-rest-api?apiVersion=2022-11-28 -GITHUB_TOKEN= +REPORT_GITHUB_TOKEN= diff --git a/packages/scripts/src/utils/github.ts b/packages/scripts/src/utils/github.ts index a26d4684..6d91db1a 100644 --- a/packages/scripts/src/utils/github.ts +++ b/packages/scripts/src/utils/github.ts @@ -3,7 +3,8 @@ import { paginateRest } from '@octokit/plugin-paginate-rest' import { paginateGraphql } from '@octokit/plugin-paginate-graphql' import { assert } from './error' -const TOKEN = process.env.GITHUB_TOKEN +const TOKEN = process.env.REPORT_GITHUB_TOKEN +assert(TOKEN != null && TOKEN !== '', 'REPORT_GITHUB_TOKEN is required') const EnhancedOctokit = Octokit.plugin(paginateRest, paginateGraphql) const octokit = new EnhancedOctokit({ auth: TOKEN })