如何从自定义操作的Dockerfile访问GitHub变量?

发布于 2025-02-03 05:06:03 字数 909 浏览 0 评论 0原文

我有这个工作流yaml文件:

name: PHP code review

on: push

jobs:
  phpunit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: PHPUnit
      uses: ./.github/actions/phpunit

这是.github/action/phpunit/action.yml file:

name: PHPUnit in Docker
description: Run PHPUnit in a custom configured Docker container

runs:
  using: 'docker'
  image: phpunit.dockerfile

这是dockerfile:

FROM ubuntu

# Update aptitude with new repo
RUN apt-get update

# Install software 
RUN apt-get install -y git

# Clone the conf files into the docker container
RUN git clone https://${{ secrets.PHPUNIT_ACCESS_TOKEN }}@github.com/${{ GITHUB_REPOSITORY }}

但是在dockerfile中,它看起来像一个字符串,而不是可变的。

如何访问Dockerfile中的GitHub变量?

I have this workflow yaml file:

name: PHP code review

on: push

jobs:
  phpunit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: PHPUnit
      uses: ./.github/actions/phpunit

This is the .github/actions/phpunit/action.yml file:

name: PHPUnit in Docker
description: Run PHPUnit in a custom configured Docker container

runs:
  using: 'docker'
  image: phpunit.dockerfile

And this is the Dockerfile:

FROM ubuntu

# Update aptitude with new repo
RUN apt-get update

# Install software 
RUN apt-get install -y git

# Clone the conf files into the docker container
RUN git clone https://${{ secrets.PHPUNIT_ACCESS_TOKEN }}@github.com/${{ GITHUB_REPOSITORY }}

But in the Dockerfile it looks like a string, and not a variable.

How can I access to GitHub variables in my Dockerfile?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文