TIL: You can create your own GitHub Actions workflow templates

So you know how there’s this wizard that you can use to create new GitHub Actions right?

It turns out that there’s a way to add your own GitHub Actions templates there!

All you need to do is add a workflow-templates/*.yml and workflow-templates…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Jacob Hummer

So you know how there's this wizard that you can use to create new GitHub Actions right?

It turns out that there's a way to add your own GitHub Actions templates there!

All you need to do is add a workflow-templates/*.yml and workflow-templates/*.properties.json pair in your user/.github repository. This works for both organizations (like the official GitHub docs say) and regular users.

workflow-templates/say-hi.yml

name: Say hi!
on:
  push:
    branches: [$default-branch]
jobs:
  say-hi:
    runs-on: ubuntu-latest
    steps:
      - name: Echo "Hi!" to the user
        run: echo "Hi!"

workflow-templates/say-hi.properties.json

{
    "name": "Say hi!",
    "description": "Says hi to the user",
    "iconName": "emoji-wave",
    "categories": ["Automation"],
    "filePatterns": ["README.md"]
}

workflow-templates/emoji-wave.svg

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <text y="75px" font-size="75px">đź‘‹</text>
</svg>

đź“š Further reading: Creating starter workflows for your organization

How you might want to use this

A great way to take advantage of this template feature is to make workflow templates for things you do often or in every repository. Think like...

  1. Node.js test.yml workflow
  2. Workflow to deploy to GitHub Pages from npm run build
  3. Mirroring wiki/ to the GitHub wiki page
  4. Enabling /help in any issue

Anything that is arduous to re-type or re-reason about (like something that has complex on: * or permissions: * properties) on the workflow level is something that is a good candidate for a template.


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Jacob Hummer


Print Share Comment Cite Upload Translate Updates
APA

Jacob Hummer | Sciencx (2023-01-07T21:48:02+00:00) TIL: You can create your own GitHub Actions workflow templates. Retrieved from https://www.scien.cx/2023/01/07/til-you-can-create-your-own-github-actions-workflow-templates/

MLA
" » TIL: You can create your own GitHub Actions workflow templates." Jacob Hummer | Sciencx - Saturday January 7, 2023, https://www.scien.cx/2023/01/07/til-you-can-create-your-own-github-actions-workflow-templates/
HARVARD
Jacob Hummer | Sciencx Saturday January 7, 2023 » TIL: You can create your own GitHub Actions workflow templates., viewed ,<https://www.scien.cx/2023/01/07/til-you-can-create-your-own-github-actions-workflow-templates/>
VANCOUVER
Jacob Hummer | Sciencx - » TIL: You can create your own GitHub Actions workflow templates. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/01/07/til-you-can-create-your-own-github-actions-workflow-templates/
CHICAGO
" » TIL: You can create your own GitHub Actions workflow templates." Jacob Hummer | Sciencx - Accessed . https://www.scien.cx/2023/01/07/til-you-can-create-your-own-github-actions-workflow-templates/
IEEE
" » TIL: You can create your own GitHub Actions workflow templates." Jacob Hummer | Sciencx [Online]. Available: https://www.scien.cx/2023/01/07/til-you-can-create-your-own-github-actions-workflow-templates/. [Accessed: ]
rf:citation
» TIL: You can create your own GitHub Actions workflow templates | Jacob Hummer | Sciencx | https://www.scien.cx/2023/01/07/til-you-can-create-your-own-github-actions-workflow-templates/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.