我正在尝试编写一个自定义 github-action,它在 docker 容器中运行一些命令,但允许用户选择他们在哪个 docker 容器中运行(即,我可以在不同版本的运行时环境中运行相同的构建指令)
我的直觉是将我的.github/actions/main/action.yml文件作为
name: 'Docker container command execution'
inputs:
  dockerfile:
    default: Dockerfile_r_latest
runs:
  using: 'docker' 
  image: '${{ inputs.dockerfile }}'
  args:
   - /scripts/commands.sh
但是,此错误与:
##[error](Line: 7, Col: 10): Unrecognized named-value: 'inputs'. Located at position 1 within expression: inputs.dockerfile
任何帮助,将不胜感激 !
我的.github/workflow/build_and_test.yml文件是:
name: Test Package
on: 
  [push, pull_request]
jobs:
  R_latest:
    name: Test on latest
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
        name: Checkout project
      - uses: ./.github/actions/main
        name: Build and test
        with:
          dockerfile: Dockerfile_r_latest …我试图将输入变量的名称捕获为字符串。这相当容易使用match.call(),但是在使用 magrittr 的管道时这不起作用。想知道是否有任何简单的修改可以让它在管道中工作以及函数是否被正常调用?
library(magrittr)
myfun <- function(fun){
    print(match.call()$fun %>% as.character())
}
myfun(mean)
mean %>% myfun
myfun(iris)
iris %>% myfun
我目前正在尝试了解文件权限中的特殊位的作用,但目前仍试图了解 setuid 位的作用。从所有在线资源来看,它说:
通常称为 SUID,用户访问级别的特殊权限具有单一功能:具有 SUID 的文件始终以拥有该文件的用户身份执行,无论用户传递命令如何
然而,在一个简单的实验中,这似乎并不正确(除非我误解了并且做错了什么?)即
mkdir /tmp/foo
mkdir /tmp/foo/bar
chmod 0700 /tmp/foo/bar                        # Restrict directory so only current user can access
echo content > /tmp/foo/bar/baz.txt            # Create content in the restricted directory
echo "ls /tmp/foo/bar" > /tmp/foo/myscript.sh  # Script to access content of restricted directoy
chmod 4777 /tmp/foo/myscript.sh                # Set setuid bit so the script runs as current user
/tmp/foo/myscript.sh                           # Show it works when run as current user
#> baz.txt
su bob                 # Switch to a …