Skip to content

Commit

Permalink
Pass REPO_GITHUB_TOKEN to R-hub workflow (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored Aug 14, 2024
1 parent 48c4529 commit 2888937
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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 }}

0 comments on commit 2888937

Please sign in to comment.