Modularizing Steps
{
"type": "unordered-list",
"id": "b977f7c0-5684-40d2-8d01-03a09d79fa61",
"items": [
{
"id": "b977f7c0-5684-40d2-8d01-03a09d79fa61",
"content": [
{
"type": "code",
"content": "action.yml"
},
{
"type": "text",
"content": " is the cross-platform way to modularize steps"
}
],
"children": [
{
"type": "unordered-list",
"id": "bb538ac7-d34b-4489-9bfb-de59f3fdf212",
"items": [
{
"id": "bb538ac7-d34b-4489-9bfb-de59f3fdf212",
"content": [
{
"type": "link",
"content": "https://docs.github.com/en/actions/creating-actions/about-actions",
"url": "https://docs.github.com/en/actions/creating-actions/about-actions"
}
]
},
{
"id": "2e2a102d-d888-4575-a290-3efa4a055b99",
"content": [
{
"type": "text",
"content": "Currently writing actions in Javascript is the best way to guarentee they'll run cross-platform. "
}
],
"children": [
{
"type": "unordered-list",
"id": "f84e4817-4550-453c-8564-62ebb21a90d1",
"items": [
{
"id": "f84e4817-4550-453c-8564-62ebb21a90d1",
"content": [
{
"type": "text",
"content": "This is why all the code in "
},
{
"type": "link",
"content": "http://github.com/actions",
"url": "http://github.com/actions/"
},
{
"type": "text",
"content": " is written in Javascript"
}
]
},
{
"id": "8ff1af76-5084-4a55-b9aa-e5a4fa34486b",
"content": [
{
"type": "link",
"content": "using: composite",
"url": "https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action"
},
{
"type": "text",
"content": " may be alright for tiny tasks."
}
]
}
]
}
]
}
]
},
{
"id": "0e0c67cf-df08-46fb-9e9a-f161b400ecea",
"type": "code",
"content": [
{
"type": "text",
"content": "name: 'Hello World'\ndescription: 'Greet someone and record the time'\ninputs:\n who-to-greet: # id of input\n description: 'Who to greet'\n required: true\n default: 'World'\noutputs:\n time: # id of output\n description: 'The time we greeted you'\nruns:\n using: 'node12' # \n main: 'index.js'"
}
],
"language": "yaml"
}
]
}
]
}Example
{
"id": "b962346e-e25d-4d98-bdf0-cf4c600d7f9e",
"type": "code",
"content": [
{
"type": "text",
"content": "name: Test\non: pull_request\nenv:\n GOPRIVATE: github.com/matthewmueller/go-gen\njobs:\n test:\n strategy:\n matrix:\n go-version: [1.15.x, 1.16.x]\n # Ignore windows until it's public\n # os: [ubuntu-latest, macos-latest, windows-latest]\n os: [ubuntu-latest, macos-latest]\n runs-on: ${{ matrix.os }}\n steps:\n\n - name: Install Go\n uses: actions/setup-go@v2\n with:\n go-version: ${{ matrix.go-version }}\n\n - name: Checkout code\n uses: actions/checkout@v2\n\n\t\t- name: Restore Cache\n uses: actions/cache@preview\n id: cache\n with:\n path: ~/go/pkg/mod\n key: ${{ runner.os }}-${{ hashFiles('**/go.sum') }}\n\n - name: Configure git for private modules\n env:\n TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}\n run: git config --global url.\"https://matthewmueller:${TOKEN}@github.com\".insteadOf \"https://github.com\"\n\n - name: Test\n run: go test ./..."
}
],
"language": "yaml"
}Resources
{
"type": "unordered-list",
"id": "07cf53b5-4ddf-463d-8ede-d80ba35f1a0b",
"items": [
{
"id": "07cf53b5-4ddf-463d-8ede-d80ba35f1a0b",
"content": [
{
"type": "link",
"content": "https://github.com/tailscale/tailscale/tree/main/.github",
"url": "https://github.com/tailscale/tailscale/tree/main/.github"
}
]
},
{
"id": "ac771e2b-9d46-4114-b102-8b5d4c4cf369",
"content": [
{
"type": "link",
"content": "https://github.com/mvdan/github-actions-golang",
"url": "https://github.com/mvdan/github-actions-golang"
}
]
}
]
}