File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 required : false
2323 type : string
2424 default : ' "warning"'
25+ generate_token :
26+ description : Generate token from GitHub app
27+ required : false
28+ type : boolean
29+ default : false
30+ secrets :
31+ TOKEN_APP_ID :
32+ description : ID of the GitHub app used to generate a new token
33+ required : false
34+ TOKEN_APP_PRIVATE_KEY :
35+ description : Private Key for the GitHub app used to generate a new token
36+ required : false
2537permissions :
2638 contents : read
2739jobs :
4860 ERROR_ON_DEFAULT : ' "warning"'
4961 steps :
5062 - uses : actions/checkout@v4
63+ - name : Generate custom token
64+ id : generate-token
65+ if : ${{ inputs.generate_token }}
66+ uses : actions/create-github-app-token@v2
67+ with :
68+ app-id : ${{ secrets.TOKEN_APP_ID }}
69+ private-key : ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
70+ owner : ${{ github.repository_owner }}
5171 - name : Package specific setup
5272 if : ${{ inputs.use_local_setup_action }}
5373 uses : ./.github/actions/setup
5878 http-user-agent : ' ${{matrix.config.http-user-agent}}'
5979 use-public-rspm : true
6080 - uses : r-lib/actions/setup-r-dependencies@v2
81+ env :
82+ GITHUB_PAT : ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
6183 with :
6284 extra-packages : ' any::rcmdcheck'
6385 needs : check
Original file line number Diff line number Diff line change 2222 required : false
2323 type : string
2424 default : ' "warning"'
25+ generate_token :
26+ description : Generate token from GitHub app
27+ required : false
28+ type : boolean
29+ default : false
30+ secrets :
31+ TOKEN_APP_ID :
32+ description : ID of the GitHub app used to generate a new token
33+ required : false
34+ TOKEN_APP_PRIVATE_KEY :
35+ description : Private Key for the GitHub app used to generate a new token
36+ required : false
2537permissions :
2638 contents : read
2739jobs :
4557 ERROR_ON_DEFAULT : ' "warning"'
4658 steps :
4759 - uses : actions/checkout@v4
60+ - name : Generate custom token
61+ id : generate-token
62+ if : ${{ inputs.generate_token }}
63+ uses : actions/create-github-app-token@v2
64+ with :
65+ app-id : ${{ secrets.TOKEN_APP_ID }}
66+ private-key : ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
67+ owner : ${{ github.repository_owner }}
4868 - name : Package specific setup
4969 if : ${{ inputs.use_local_setup_action }}
5070 uses : ./.github/actions/setup
5575 use-public-rspm : false
5676 cran : ' https://packagemanager.posit.co/cran/${{matrix.config.date}}'
5777 - uses : r-lib/actions/setup-r-dependencies@v2
78+ env :
79+ GITHUB_PAT : ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
5880 with :
5981 extra-packages : ' any::rcmdcheck'
6082 needs : check
Original file line number Diff line number Diff line change 2222 required : false
2323 type : boolean
2424 default : false
25+ generate_token :
26+ description : Generate token from GitHub app
27+ required : false
28+ type : boolean
29+ default : false
30+ secrets :
31+ TOKEN_APP_ID :
32+ description : ID of the GitHub app used to generate a new token
33+ required : false
34+ TOKEN_APP_PRIVATE_KEY :
35+ description : Private Key for the GitHub app used to generate a new token
36+ required : false
2537permissions :
2638 contents : read
2739 pull-requests : write
@@ -30,13 +42,23 @@ jobs:
3042 runs-on : ubuntu-latest
3143 steps :
3244 - uses : actions/checkout@v4
45+ - name : Generate custom token
46+ id : generate-token
47+ if : ${{ inputs.generate_token }}
48+ uses : actions/create-github-app-token@v2
49+ with :
50+ app-id : ${{ secrets.TOKEN_APP_ID }}
51+ private-key : ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
52+ owner : ${{ github.repository_owner }}
3353 - name : Package specific setup
3454 if : ${{ inputs.use_local_setup_action }}
3555 uses : ./.github/actions/setup
3656 - uses : r-lib/actions/setup-r@v2
3757 with :
3858 use-public-rspm : true
3959 - uses : r-lib/actions/setup-r-dependencies@v2
60+ env :
61+ GITHUB_PAT : ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
4062 with :
4163 extra-packages : |
4264 any::covr
Original file line number Diff line number Diff line change 2020 required : false
2121 type : boolean
2222 default : false
23+ generate_token :
24+ description : Generate token from GitHub app
25+ required : false
26+ type : boolean
27+ default : false
28+ secrets :
29+ TOKEN_APP_ID :
30+ description : ID of the GitHub app used to generate a new token
31+ required : false
32+ TOKEN_APP_PRIVATE_KEY :
33+ description : Private Key for the GitHub app used to generate a new token
34+ required : false
2335permissions :
2436 contents : write
2537 pull-requests : write
3042 group : ' pkgdown-${{ github.event_name != '' pull_request'' || github.run_id }}'
3143 steps :
3244 - uses : actions/checkout@v4
45+ - name : Generate custom token
46+ id : generate-token
47+ if : ${{ inputs.generate_token }}
48+ uses : actions/create-github-app-token@v2
49+ with :
50+ app-id : ${{ secrets.TOKEN_APP_ID }}
51+ private-key : ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
52+ owner : ${{ github.repository_owner }}
3353 - name : Package specific setup
3454 if : ${{ inputs.use_local_setup_action }}
3555 uses : ./.github/actions/setup
3858 with :
3959 use-public-rspm : true
4060 - uses : r-lib/actions/setup-r-dependencies@v2
61+ env :
62+ GITHUB_PAT : ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
4163 with :
4264 extra-packages : ' any::pkgdown, local::.'
4365 needs : website
Original file line number Diff line number Diff line change 8888...
8989` ` `
9090You can of course add much more complicated setup steps this way, but now Quarto is available for all following steps in the `R-CMD-check standard` workflow.
91+
92+ # # Install from private repositories in your organisation
93+
94+ If you have dependencies on private repositories insider your GitHub organisation
95+ you need to run the workflows (excluding MegaLinter) with `generate_token : true` input,
96+ and supply an App Id and App Private key as secrets.
97+
98+ Using e.g. the `R-CMD-check standard` workflow it can be done like this :
99+
100+ ` ` ` yaml
101+ ...
102+ jobs:
103+ check-current-version:
104+ name: Check current version
105+ uses: >-
106+ NovoNordisk-OpenSource/r.workflows/.github/workflows/check_current_version.yaml@main
107+ secrets:
108+ TOKEN_APP_ID: ${{ secrets.TOKEN_APP_ID }}
109+ TOKEN_APP_PRIVATE_KEY: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
110+ with:
111+ generate_token: true
112+ ...
113+ ` ` `
114+
115+ Where the secrets point to a GitHub App in your organisation that have read access to the relevant
116+ repositories. Using the `actions/create-github-app-token@v2` action this generates a new token, that
117+ have the neccasary acess, to be used in the step setting up the R dependencies.
118+
119+ See also [Authenticating with a GitHub App](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow#authenticating-with-a-github-app)
120+ for more information on this way of authenticating.
You can’t perform that action at this time.
0 commit comments