diff --git a/.github/workflows/rhub.yaml b/.github/workflows/rhub.yaml index 63edc071..d799dc73 100644 --- a/.github/workflows/rhub.yaml +++ b/.github/workflows/rhub.yaml @@ -6,6 +6,11 @@ name: R-hub 🌐 on: workflow_call: + secrets: + REPO_GITHUB_TOKEN: + description: | + Github token with read access to repositories + required: false inputs: config: description: 'A comma separated list of R-hub platforms to use.' @@ -71,11 +76,22 @@ jobs: image: ${{ matrix.config.container }} steps: + - name: Setup token 🔑 + id: github-token + run: | + if [ "${{ secrets.REPO_GITHUB_TOKEN }}" == "" ]; then + echo "REPO_GITHUB_TOKEN is empty. Substituting it with GITHUB_TOKEN." + echo "token=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT + else + echo "Using REPO_GITHUB_TOKEN." + echo "token=${{ secrets.REPO_GITHUB_TOKEN }}" >> $GITHUB_OUTPUT + fi + shell: bash + - uses: r-hub/actions/checkout@v1 - uses: r-hub/actions/platform-info@v1 with: - token: ${{ secrets.RHUB_TOKEN }} job-config: ${{ matrix.config.job-config }} - name: Prepare DESCRIPTION file @@ -86,13 +102,13 @@ jobs: - uses: r-hub/actions/setup-deps@v1 with: - token: ${{ secrets.RHUB_TOKEN }} job-config: ${{ matrix.config.job-config }} needs: DepsDev,DepsBranch + env: + GITHUB_PAT: ${{ steps.github-token.outputs.token }} - uses: r-hub/actions/run-check@v1 with: - token: ${{ secrets.RHUB_TOKEN }} job-config: ${{ matrix.config.job-config }} other-platforms: @@ -106,16 +122,26 @@ jobs: config: ${{ fromJson(needs.setup.outputs.platforms) }} steps: + - name: Setup token 🔑 + id: github-token + run: | + if [ "${{ secrets.REPO_GITHUB_TOKEN }}" == "" ]; then + echo "REPO_GITHUB_TOKEN is empty. Substituting it with GITHUB_TOKEN." + echo "token=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT + else + echo "Using REPO_GITHUB_TOKEN." + echo "token=${{ secrets.REPO_GITHUB_TOKEN }}" >> $GITHUB_OUTPUT + fi + shell: bash + - uses: r-hub/actions/checkout@v1 - uses: r-hub/actions/setup-r@v1 with: job-config: ${{ matrix.config.job-config }} - token: ${{ secrets.RHUB_TOKEN }} - uses: r-hub/actions/platform-info@v1 with: - token: ${{ secrets.RHUB_TOKEN }} job-config: ${{ matrix.config.job-config }} - name: Setup R dependencies @@ -127,10 +153,10 @@ jobs: - uses: r-hub/actions/setup-deps@v1 with: job-config: ${{ matrix.config.job-config }} - token: ${{ secrets.RHUB_TOKEN }} needs: DepsDev,DepsBranch + env: + GITHUB_PAT: ${{ steps.github-token.outputs.token }} - uses: r-hub/actions/run-check@v1 with: job-config: ${{ matrix.config.job-config }} - token: ${{ secrets.RHUB_TOKEN }}