|
1 | 1 | # This tests having a "subworkflow" using reusable workflows |
2 | 2 | # https://docs.github.com/en/actions/learn-github-actions/reusing-workflows |
3 | | -# This doesn't really work how I'd like it to right now, but in the future it might: |
4 | | -# https://github.community/t/ref-head-in-reusable-workflows/203690/4 |
5 | | -# -- Edit: Work's how I'd hope now! https://github.blog/changelog/2022-01-25-github-actions-reusable-workflows-can-be-referenced-locally/ |
6 | 3 | # ========================== |
7 | 4 | # There's a second variant using composite actions instead |
8 | 5 | # https://docs.github.com/en/actions/creating-actions/creating-a-composite-action |
|
15 | 12 | # It also seems to be a watered down version of the workflow syntax. (For instance naming steps doesn't work.) |
16 | 13 | # -- Actualy naming steps supposedly should work, but doesn't appear anywhere from what I can see https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runsstepsname |
17 | 14 | # -- It's still a watered down version of the workflow syntax though. |
18 | | -# I think it's probably best that we wait for local reusable workflows. |
19 | | -# Sadly this isn't on the GitHub roadmap yet, so I'm not holding my breath on it. |
20 | | -# In theory I just hard-code the owner/repo and `main` reference but that doesn't really jive well with my CI development workflow... |
21 | 15 | name: Subworkflow Test |
22 | 16 | on: [workflow_dispatch] |
23 | 17 | jobs: |
24 | 18 | test: |
25 | 19 | name: Main job thing |
26 | | - # This does not work, very annoying they don't have any special syntax for "Just use a file in this repo" |
27 | | - #uses: ${{github.repository}}/.github/workflows/subworkflow.yml@${{github.sha}} |
28 | | - # This doesn't work either, seems expressions just aren't even allowed here. |
29 | | - #uses: PathogenPlayground/GitHubActionsTest/.github/workflows/subworkflow.yml@${{github.sha}} |
30 | | - #uses: PathogenPlayground/GitHubActionsTest/.github/workflows/subworkflow.yml@main |
31 | | - # Just released! https://github.blog/changelog/2022-01-25-github-actions-reusable-workflows-can-be-referenced-locally/ |
| 20 | + # Using a workflow from the local repo |
32 | 21 | uses: ./.github/workflows/subworkflow.yml |
33 | 22 | with: |
34 | 23 | username: Path |
35 | 24 | test-noname: |
36 | 25 | uses: ./.github/workflows/subworkflow.yml |
37 | 26 | with: |
38 | 27 | username: Pathogen |
39 | | -# test2: |
40 | | -# name: Test using composite action |
41 | | -# runs-on: ubuntu-latest |
42 | | -# steps: |
43 | | -# - uses: actions/checkout@v2 |
44 | | -# - id: foo |
45 | | -# uses: ./.github/workflows/hello-world-composite-action |
46 | | -# with: |
47 | | -# who-to-greet: Path |
48 | | -# - run: echo random-number ${{ steps.foo.outputs.random-number }} |
| 28 | + test2: |
| 29 | + name: Test using composite action |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v2 |
| 33 | + - id: foo |
| 34 | + uses: ./.github/workflows/hello-world-composite-action |
| 35 | + with: |
| 36 | + who-to-greet: Path |
| 37 | + - run: echo random-number ${{ steps.foo.outputs.random-number }} |
0 commit comments