Skip to content

Commit

Permalink
feat(workflows): allows to define job runner
Browse files Browse the repository at this point in the history
  • Loading branch information
neilime committed Oct 4, 2023
1 parent 2238118 commit 75ccdcc
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 31 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/generate-dependabot-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ jobs:
<!-- end secrets -->
<!-- start inputs -->
| **Inputs** | **Description** | **Default** | **Required** |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------ |
| **<code>github-app-id</code>** | GitHub App ID to generate GitHub token in place of <code>github-token</code>. See [https://github.com/tibdex/github-app-token](https://github.com/tibdex/github-app-token) | <code></code> | **false** |
| **Inputs** | **Description** | **Default** | **Required** |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ |
| **<code>runs-on</code>** | Json array of runner(s) to use. See [https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job](https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | <code>["ubuntu-latest"]</code> | **false** |
| **<code>github-app-id</code>** | GitHub App ID to generate GitHub token in place of <code>github-token</code>. See [https://github.com/tibdex/github-app-token](https://github.com/tibdex/github-app-token) | <code></code> | **false** |
<!-- end inputs -->
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/generate-dependabot-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ name: Generate Dependabot Config
on:
workflow_call:
inputs:
runs-on:
description: "Json array of runner(s) to use. See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job"
type: string
default: '["ubuntu-latest"]'
required: false
github-app-id:
description: "GitHub App ID to generate GitHub token in place of github-token. See https://github.com/tibdex/github-app-token"
required: false
Expand All @@ -22,7 +27,7 @@ on:
jobs:
generate-dependabot-config:
name: Generate Dependabot Config
runs-on: ubuntu-latest
runs-on: ${{ fromJson(inputs.runs-on) }}
steps:
- uses: actions/checkout@v4

Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/greetings.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ jobs:
<!-- end secrets -->
<!-- start inputs -->
| **Input** | **Description** | **Default** | **Required** |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------ |
| **<code>issue-message</code>** | Comment to post on an individual's first issue. See [https://github.com/actions/first-interaction#usage](https://github.com/actions/first-interaction#usage) | <code>Hi, thank for reporting an issue, we will check it out very soon</code> | **false** |
| **<code>issue-message</code>** | Comment to post on an individual's first pull request. See [https://github.com/actions/first-interaction#usage](https://github.com/actions/first-interaction#usage) | <code>Hi, thank you for creating your PR, we will check it out very soon</code> | **false** |
| **Input** | **Description** | **Default** | **Required** |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------ |
| **<code>runs-on</code>** | Json array of runner(s) to use. See [https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job](https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | <code>["ubuntu-latest"]</code> | **false** |
| **<code>issue-message</code>** | Comment to post on an individual's first issue. See [https://github.com/actions/first-interaction#usage](https://github.com/actions/first-interaction#usage) | <code>Hi, thank for reporting an issue, we will check it out very soon</code> | **false** |
| **<code>issue-message</code>** | Comment to post on an individual's first pull request. See [https://github.com/actions/first-interaction#usage](https://github.com/actions/first-interaction#usage) | <code>Hi, thank you for creating your PR, we will check it out very soon</code> | **false** |
<!-- end inputs -->
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ on:

workflow_call:
inputs:
runs-on:
description: "Json array of runner(s) to use. See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job"
type: string
default: '["ubuntu-latest"]'
required: false
issue-message:
description: "Comment to post on an individual's first issue. See https://github.com/actions/first-interaction#usage"
type: string
Expand All @@ -29,7 +34,7 @@ on:

jobs:
greeting:
runs-on: ubuntu-latest
runs-on: ${{ fromJson(inputs.runs-on) }}
steps:
- uses: actions/first-interaction@v1
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/linter.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ jobs:
<!-- end usage -->
<!-- start secrets -->
| **Secret** | **Description** | **Default** | **Required** |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ------------ |
| **<code>github-token</code>** | Token for marking the status of linter run in the Checks section. See [https://github.com/super-linter/super-linter#how-to-use](https://github.com/super-linter/super-linter#how-to-use) | <code>GITHUB_TOKEN</code> | **false** |
| **Secret** | **Description** | **Default** | **Required** |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ |
| **<code>runs-on</code>** | Json array of runner(s) to use. See [https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job](https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | <code>["ubuntu-latest"]</code> | **false** |
| **<code>github-token</code>** | Token for marking the status of linter run in the Checks section. See [https://github.com/super-linter/super-linter#how-to-use](https://github.com/super-linter/super-linter#how-to-use) | <code>GITHUB_TOKEN</code> | **false** |
<!-- end secrets -->
<!-- start inputs -->
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ name: Linter

on:
workflow_call:
inputs:
runs-on:
description: "Json array of runner(s) to use. See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job"
type: string
default: '["ubuntu-latest"]'
required: false
secrets:
github-token:
description: 'Token for marking the status of linter run in the Checks section. See https://github.com/super-linter/super-linter#how-to-use'

jobs:
checks:
runs-on: "ubuntu-latest"
runs-on: ${{ fromJson(inputs.runs-on) }}
name: Run checks
steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/release-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ jobs:
<!-- end secrets -->
<!-- start inputs -->
| **Input** | **Description** | **Default** | **Required** |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------------ |
| **<code>update-all</code>** | Update all actions and workflows, regardless of changes. | <code>false</code> | **false** |
| **<code>github-app-id</code>** | GitHub App ID to generate GitHub token in place of private-access-token. See [https://github.com/tibdex/github-app-token](https://github.com/tibdex/github-app-token) | <code></code> | **false** |
| **Input** | **Description** | **Default** | **Required** |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ |
| **<code>runs-on</code>** | Json array of runner(s) to use. See [https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job](https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | <code>["ubuntu-latest"]</code> | **false** |
| **<code>update-all</code>** | Update all actions and workflows, regardless of changes. | <code>false</code> | **false** |
| **<code>github-app-id</code>** | GitHub App ID to generate GitHub token in place of private-access-token. See [https://github.com/tibdex/github-app-token](https://github.com/tibdex/github-app-token) | <code></code> | **false** |
<!-- end inputs -->
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/release-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ name: Release Actions
on:
workflow_call:
inputs:
runs-on:
description: "Json array of runner(s) to use. See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job"
type: string
default: '["ubuntu-latest"]'
required: false
update-all:
description: "Update all actions and workflows, regardless of changes."
required: false
Expand All @@ -26,7 +31,7 @@ on:

jobs:
prepare-release:
runs-on: "ubuntu-latest"
runs-on: ${{ fromJson(inputs.runs-on) }}
outputs:
changed-actions: ${{ steps.get-changed-actions.outputs.result }}
changed-workflows: ${{ steps.get-changed-workflows.outputs.result }}
Expand Down Expand Up @@ -111,7 +116,7 @@ jobs:
generate-actions-readme:
needs: prepare-release
runs-on: ubuntu-latest
runs-on: ${{ fromJson(inputs.runs-on) }}
if: ${{ needs.prepare-release.outputs.changed-actions != '[]' }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -140,7 +145,7 @@ jobs:

generate-workflows-readme:
needs: prepare-release
runs-on: ubuntu-latest
runs-on: ${{ fromJson(inputs.runs-on) }}
if: ${{ needs.prepare-release.outputs.changed-workflows != '[]' }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -170,7 +175,7 @@ jobs:
publish-actions-readme:
needs: [prepare-release, generate-actions-readme, generate-workflows-readme]
if: always() && (needs.prepare-release.outputs.changed-actions != '[]' || needs.prepare-release.outputs.changed-workflows != '[]')
runs-on: ubuntu-latest
runs-on: ${{ fromJson(inputs.runs-on) }}

permissions:
pull-requests: write
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/semantic-pull-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ jobs:
<!-- end secrets -->
<!-- start inputs -->
<!-- start inputs -->
| **Input** | **Description** | **Default** | **Required** |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ |
| **<code>runs-on</code>** | Json array of runner(s) to use. See [https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job](https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | <code>["ubuntu-latest"]</code> | **false** |
<!-- end inputs -->
<!-- end inputs -->
<!-- start outputs -->
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ on:
- synchronize

workflow_call:
inputs:
runs-on:
description: "The type of machine to run on. Default: ubuntu-latest"
required: false
type: string
default: "ubuntu-latest"
secrets:
github-token:
description: "Token for the repository. Default: GITHUB_TOKEN"
Expand All @@ -27,7 +33,7 @@ permissions:
jobs:
lint:
name: Validate PR title
runs-on: ubuntu-latest
runs-on: ${{ inputs.runs-on && fromJson(inputs.runs-on) || 'ubuntu-latest' }}

steps:
- uses: amannn/action-semantic-pull-request@v5
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/stale.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ jobs:
<!-- end usage -->
<!-- start inputs -->
| **Input** | **Description** | **Default** | **Required** |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- | ------------ |
| **<code>stale-issue-message</code>** | Comment on the staled issues. See [https://github.com/actions/stale#stale-issue-message](https://github.com/actions/stale#stale-issue-message) | <code>This issue is stale</code> | **false** |
| **<code>stale-pr-message</code>** | Comment on the staled PRs. See [https://github.com/actions/stale#stale-pr-message](https://github.com/actions/stale#stale-pr-message) | <code>This PR is stale</code> | **false** |
| **<code>stale-issue-label</code>** | Label to apply on staled issues. See [https://github.com/actions/stale#stale-issue-label](https://github.com/actions/stale#stale-issue-label) | <code>no-issue-activity</code> | **false** |
| **<code>exempt-issue-labels</code>** | Labels on issues exempted from stale. See [https://github.com/actions/stale#exempt-issue-labels](https://github.com/actions/stale#exempt-issue-labels) | <code>awaiting-approval,work-in-progress</code> | **false** |
| **<code>stale-pr-label</code>** | Label to apply on staled PRs. See [https://github.com/actions/stale#stale-pr-label](https://github.com/actions/stale#stale-pr-label) | <code>no-pr-activity</code> | **false** |
| **<code>exempt-pr-labels</code>** | Labels on PRs exempted from stale. See [https://github.com/actions/stale#exempt-pr-labels](https://github.com/actions/stale#exempt-pr-labels) | <code>awaiting-approval,work-in-progress</code> | **false** |
| **Input** | **Description** | **Default** | **Required** |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ------------ |
| **<code>runs-on</code>** | Json array of runner(s) to use. See [https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job](https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job) | <code>["ubuntu-latest"]</code> | **false** |
| **<code>stale-issue-message</code>** | Comment on the staled issues. See [https://github.com/actions/stale#stale-issue-message](https://github.com/actions/stale#stale-issue-message) | <code>This issue is stale</code> | **false** |
| **<code>stale-pr-message</code>** | Comment on the staled PRs. See [https://github.com/actions/stale#stale-pr-message](https://github.com/actions/stale#stale-pr-message) | <code>This PR is stale</code> | **false** |
| **<code>stale-issue-label</code>** | Label to apply on staled issues. See [https://github.com/actions/stale#stale-issue-label](https://github.com/actions/stale#stale-issue-label) | <code>no-issue-activity</code> | **false** |
| **<code>exempt-issue-labels</code>** | Labels on issues exempted from stale. See [https://github.com/actions/stale#exempt-issue-labels](https://github.com/actions/stale#exempt-issue-labels) | <code>awaiting-approval,work-in-progress</code> | **false** |
| **<code>stale-pr-label</code>** | Label to apply on staled PRs. See [https://github.com/actions/stale#stale-pr-label](https://github.com/actions/stale#stale-pr-label) | <code>no-pr-activity</code> | **false** |
| **<code>exempt-pr-labels</code>** | Labels on PRs exempted from stale. See [https://github.com/actions/stale#exempt-pr-labels](https://github.com/actions/stale#exempt-pr-labels) | <code>awaiting-approval,work-in-progress</code> | **false** |
<!-- end inputs -->
<!-- start outputs -->
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:

workflow_call:
inputs:
runs-on:
description: "Json array of runner(s) to use. See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job"
type: string
default: '["ubuntu-latest"]'
required: false
stale-issue-message:
description: "Comment on the staled issues. See https://github.com/actions/stale#stale-issue-message"
type: string
Expand Down Expand Up @@ -38,7 +43,7 @@ on:

jobs:
stale:
runs-on: ubuntu-latest
runs-on: ${{ inputs.runs-on && fromJson(inputs.runs-on) || 'ubuntu-latest' }}

steps:
- uses: actions/stale@v8
Expand Down

0 comments on commit 75ccdcc

Please sign in to comment.