简体   繁体   English

如何在 github 操作中创建文件夹?

[英]How to create a folder in github actions?

I am new to github actions and need some help.我是 github 行动的新手,需要一些帮助。

I have a readme.md file for a collection of scripts that is 100s of lines long.我有一个 readme.md 文件,用于包含 100 行长的脚本集合。 I want to translate it into different languages using this github action ( https://github.com/dephraiim/translate-readme )我想使用这个 github 操作将它翻译成不同的语言( https://github.com/dephraiim/translate-readme

But instead of putting all the files it creates into the main directory.但不是将它创建的所有文件都放入主目录中。 I want to create a folder inside my directory and put all these created files in there.我想在我的目录中创建一个文件夹并将所有这些创建的文件放在那里。

So in the main directory I have all the scripts I've written and one readme.md file.所以在主目录中,我有我编写的所有脚本和一个 readme.md 文件。 What I want is something like this.我想要的是这样的东西。

Maindirectory/newreadmefolder/(all the new language readme.md files) Maindirectory/newreadmefolder/(所有新语言readme.md文件)

A directory can be created this way.:可以这样创建一个目录:

      - name: Create dir
        run: |
          mkdir mydirname

This has to be added in steps part like in this full action file:这必须在steps部分添加,就像在这个完整的操作文件中一样:

name: mkdir example

on:
  push:
    branches: [ '**' ]
  
  workflow_dispatch:


jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Create dir
        run: |
          mkdir mydirname

If you also want to move some file, you can add something like mv readme-*.md mydirname at the end, eg:如果你还想移动一些文件,你可以在最后添加类似mv readme-*.md mydirname的内容,例如:

      - name: Create dir
        run: |
          mkdir mydirname
          mv readme-*.md mydirname

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM