Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing GitHub PAT during Docker build using GitHub Actions #199

Closed
mattwarkentin opened this issue Oct 28, 2020 · 5 comments
Closed

Exposing GitHub PAT during Docker build using GitHub Actions #199

mattwarkentin opened this issue Oct 28, 2020 · 5 comments

Comments

@mattwarkentin
Copy link
Contributor

Hi @jimhester,

I was wondering if you could suggest a best-practice for making sure remotes::install_github() has access to my GITHUB_PAT. The extra layer of complexity is that remotes::install_github() is called during a Docker image build. I thought that just defining the GITHUB_PAT as an environment variable within the Action would make it all work, but perhaps the PAT isn't inherited by the Docker build.

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build Docker Image
        env:
          GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
        run: |
          docker build . --file Dockerfile --build-arg GPAT=${GITHUB_PAT} --tag name/image

Where the Dockerfile contains something like:

ARG GPAT
ENV GITHUB_PAT=${GPAT}
RUN R -e "remotes::install_github('r-lib/actions')"
@mattwarkentin mattwarkentin added the bug an unexpected problem or unintended behavior label Oct 28, 2020
@jimhester jimhester removed the bug an unexpected problem or unintended behavior label Oct 29, 2020
@jimhester
Copy link
Member

What you have looks to me like it should work, I don't know why it does not.

I would suggest you ask in other venues, this doesn't seem to have anything to do with the custom R actions.

e.g. either https://github.community/c/github-actions/41 or https://community.rstudio.com/ would be better avenues for this sort of question.

@nturaga
Copy link

nturaga commented Oct 11, 2022

@mattwarkentin Did you ever figure this issue out?

@mattwarkentin
Copy link
Contributor Author

Umm, I'm not sure what ever came of this issue, really. Did you try the proposed solution in the original post?

@nturaga
Copy link

nturaga commented Oct 11, 2022

Umm, I'm not sure what ever came of this issue, really. Did you try the proposed solution in the original post?

Yes, it doesn't seem to work as Github actions isn't able to read the PAT for some reason.

@github-actions
Copy link

github-actions bot commented Nov 4, 2022

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants