From 75ccdcc176fa5998367fd96a83623fc36544916e Mon Sep 17 00:00:00 2001 From: Emilien Escalle Date: Wed, 4 Oct 2023 18:24:38 +0200 Subject: [PATCH] feat(workflows): allows to define job runner --- .github/workflows/generate-dependabot-config.md | 7 ++++--- .../workflows/generate-dependabot-config.yml | 7 ++++++- .github/workflows/greetings.md | 9 +++++---- .github/workflows/greetings.yml | 7 ++++++- .github/workflows/linter.md | 7 ++++--- .github/workflows/linter.yml | 8 +++++++- .github/workflows/release-actions.md | 9 +++++---- .github/workflows/release-actions.yml | 13 +++++++++---- .github/workflows/semantic-pull-request.md | 9 +++++++++ .github/workflows/semantic-pull-request.yml | 8 +++++++- .github/workflows/stale.md | 17 +++++++++-------- .github/workflows/stale.yml | 7 ++++++- 12 files changed, 77 insertions(+), 31 deletions(-) diff --git a/.github/workflows/generate-dependabot-config.md b/.github/workflows/generate-dependabot-config.md index 965ed75..3c18908 100644 --- a/.github/workflows/generate-dependabot-config.md +++ b/.github/workflows/generate-dependabot-config.md @@ -49,9 +49,10 @@ jobs: -| **Inputs** | **Description** | **Default** | **Required** | -| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------ | -| **github-app-id** | GitHub App ID to generate GitHub token in place of github-token. See [https://github.com/tibdex/github-app-token](https://github.com/tibdex/github-app-token) | | **false** | +| **Inputs** | **Description** | **Default** | **Required** | +| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ | +| **runs-on** | 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) | ["ubuntu-latest"] | **false** | +| **github-app-id** | GitHub App ID to generate GitHub token in place of github-token. See [https://github.com/tibdex/github-app-token](https://github.com/tibdex/github-app-token) | | **false** | diff --git a/.github/workflows/generate-dependabot-config.yml b/.github/workflows/generate-dependabot-config.yml index 755a7c5..ed32a9b 100644 --- a/.github/workflows/generate-dependabot-config.yml +++ b/.github/workflows/generate-dependabot-config.yml @@ -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 @@ -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 diff --git a/.github/workflows/greetings.md b/.github/workflows/greetings.md index a17e39e..727d7e6 100644 --- a/.github/workflows/greetings.md +++ b/.github/workflows/greetings.md @@ -54,10 +54,11 @@ jobs: -| **Input** | **Description** | **Default** | **Required** | -| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------ | -| **issue-message** | Comment to post on an individual's first issue. See [https://github.com/actions/first-interaction#usage](https://github.com/actions/first-interaction#usage) | Hi, thank for reporting an issue, we will check it out very soon | **false** | -| **issue-message** | 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) | Hi, thank you for creating your PR, we will check it out very soon | **false** | +| **Input** | **Description** | **Default** | **Required** | +| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------ | +| **runs-on** | 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) | ["ubuntu-latest"] | **false** | +| **issue-message** | Comment to post on an individual's first issue. See [https://github.com/actions/first-interaction#usage](https://github.com/actions/first-interaction#usage) | Hi, thank for reporting an issue, we will check it out very soon | **false** | +| **issue-message** | 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) | Hi, thank you for creating your PR, we will check it out very soon | **false** | diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index e4e9727..b10742d 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -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 @@ -29,7 +34,7 @@ on: jobs: greeting: - runs-on: ubuntu-latest + runs-on: ${{ fromJson(inputs.runs-on) }} steps: - uses: actions/first-interaction@v1 with: diff --git a/.github/workflows/linter.md b/.github/workflows/linter.md index 6d5095d..938cfd3 100644 --- a/.github/workflows/linter.md +++ b/.github/workflows/linter.md @@ -37,9 +37,10 @@ jobs: -| **Secret** | **Description** | **Default** | **Required** | -| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ------------ | -| **github-token** | 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) | GITHUB_TOKEN | **false** | +| **Secret** | **Description** | **Default** | **Required** | +| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ | +| **runs-on** | 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) | ["ubuntu-latest"] | **false** | +| **github-token** | 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) | GITHUB_TOKEN | **false** | diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5a5d00d..6e0c87d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -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 diff --git a/.github/workflows/release-actions.md b/.github/workflows/release-actions.md index b1aca58..d6cda49 100644 --- a/.github/workflows/release-actions.md +++ b/.github/workflows/release-actions.md @@ -55,10 +55,11 @@ jobs: -| **Input** | **Description** | **Default** | **Required** | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ------------ | -| **update-all** | Update all actions and workflows, regardless of changes. | false | **false** | -| **github-app-id** | 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) | | **false** | +| **Input** | **Description** | **Default** | **Required** | +| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ | +| **runs-on** | 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) | ["ubuntu-latest"] | **false** | +| **update-all** | Update all actions and workflows, regardless of changes. | false | **false** | +| **github-app-id** | 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) | | **false** | diff --git a/.github/workflows/release-actions.yml b/.github/workflows/release-actions.yml index 86dc0b9..00e8f75 100644 --- a/.github/workflows/release-actions.yml +++ b/.github/workflows/release-actions.yml @@ -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 @@ -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 }} @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/semantic-pull-request.md b/.github/workflows/semantic-pull-request.md index bef24e2..b84e8ec 100644 --- a/.github/workflows/semantic-pull-request.md +++ b/.github/workflows/semantic-pull-request.md @@ -44,6 +44,15 @@ jobs: + + + +| **Input** | **Description** | **Default** | **Required** | +| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ | ------------ | +| **runs-on** | 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) | ["ubuntu-latest"] | **false** | + + + diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml index 21132fb..1eab4d1 100644 --- a/.github/workflows/semantic-pull-request.yml +++ b/.github/workflows/semantic-pull-request.yml @@ -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" @@ -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 diff --git a/.github/workflows/stale.md b/.github/workflows/stale.md index 6268d0a..f81aca7 100644 --- a/.github/workflows/stale.md +++ b/.github/workflows/stale.md @@ -60,14 +60,15 @@ jobs: -| **Input** | **Description** | **Default** | **Required** | -| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- | ------------ | -| **stale-issue-message** | Comment on the staled issues. See [https://github.com/actions/stale#stale-issue-message](https://github.com/actions/stale#stale-issue-message) | This issue is stale | **false** | -| **stale-pr-message** | Comment on the staled PRs. See [https://github.com/actions/stale#stale-pr-message](https://github.com/actions/stale#stale-pr-message) | This PR is stale | **false** | -| **stale-issue-label** | Label to apply on staled issues. See [https://github.com/actions/stale#stale-issue-label](https://github.com/actions/stale#stale-issue-label) | no-issue-activity | **false** | -| **exempt-issue-labels** | Labels on issues exempted from stale. See [https://github.com/actions/stale#exempt-issue-labels](https://github.com/actions/stale#exempt-issue-labels) | awaiting-approval,work-in-progress | **false** | -| **stale-pr-label** | Label to apply on staled PRs. See [https://github.com/actions/stale#stale-pr-label](https://github.com/actions/stale#stale-pr-label) | no-pr-activity | **false** | -| **exempt-pr-labels** | Labels on PRs exempted from stale. See [https://github.com/actions/stale#exempt-pr-labels](https://github.com/actions/stale#exempt-pr-labels) | awaiting-approval,work-in-progress | **false** | +| **Input** | **Description** | **Default** | **Required** | +| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ------------ | +| **runs-on** | 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) | ["ubuntu-latest"] | **false** | +| **stale-issue-message** | Comment on the staled issues. See [https://github.com/actions/stale#stale-issue-message](https://github.com/actions/stale#stale-issue-message) | This issue is stale | **false** | +| **stale-pr-message** | Comment on the staled PRs. See [https://github.com/actions/stale#stale-pr-message](https://github.com/actions/stale#stale-pr-message) | This PR is stale | **false** | +| **stale-issue-label** | Label to apply on staled issues. See [https://github.com/actions/stale#stale-issue-label](https://github.com/actions/stale#stale-issue-label) | no-issue-activity | **false** | +| **exempt-issue-labels** | Labels on issues exempted from stale. See [https://github.com/actions/stale#exempt-issue-labels](https://github.com/actions/stale#exempt-issue-labels) | awaiting-approval,work-in-progress | **false** | +| **stale-pr-label** | Label to apply on staled PRs. See [https://github.com/actions/stale#stale-pr-label](https://github.com/actions/stale#stale-pr-label) | no-pr-activity | **false** | +| **exempt-pr-labels** | Labels on PRs exempted from stale. See [https://github.com/actions/stale#exempt-pr-labels](https://github.com/actions/stale#exempt-pr-labels) | awaiting-approval,work-in-progress | **false** | diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 8540960..7edb4b4 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -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 @@ -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