Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-508: Every workflow that uses our checkout action should accept (and pass on) the CHECKOUT_TOKEN secret #161

Merged
merged 17 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ef236ac
Adding checkout token (and passing on to the checkout action) secret …
BenedekFarkas Dec 23, 2022
de8442c
Updating build-and-test-dotnet and deploy-to-azure-app-service workfl…
BenedekFarkas Dec 23, 2022
4b5da40
Ooops, we don't to change the branch reference for initializing Infra…
BenedekFarkas Dec 23, 2022
855a185
Updating checkout action to reset the checkout token to github.token …
BenedekFarkas Dec 23, 2022
296e86f
Using environment variable for GH token in the checkout action instead?
BenedekFarkas Dec 23, 2022
7eb55b1
Testing conditional execution of differently parameterized checkout a…
BenedekFarkas Dec 23, 2022
effb0f2
Fixing that deploy-to-azure-app-service should access CHECKOUT_TOKEN …
BenedekFarkas Dec 23, 2022
2f302cf
Reverting to previous interation of the checkout action change, which…
BenedekFarkas Dec 23, 2022
acf821f
Simplifying checkout action's parameter fallback logic, updating buil…
BenedekFarkas Dec 23, 2022
a973804
Reverting branch references in the build-and-test-dotnet workflow, be…
BenedekFarkas Dec 23, 2022
1bc44c4
Updating action references to issue branch in the build-and-test-orch…
BenedekFarkas Dec 23, 2022
93a65c2
Merge remote-tracking branch 'origin/dev' into issue/OSOE-508
BenedekFarkas Dec 23, 2022
d30e849
Removing checkout token fallback logic workflows, as the checkout act…
BenedekFarkas Dec 23, 2022
1724a44
Reverting to original fallback logic of the checkout token in the che…
BenedekFarkas Dec 23, 2022
162f1d9
Replacing issue references
Piedone Dec 24, 2022
8cff022
Revert "Replacing issue references"
Piedone Dec 24, 2022
72cff14
Revert "Revert "Replacing issue references""
Piedone Dec 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/actions/checkout/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ inputs:
runs:
using: "composite"
steps:
# This step is needed when the workflow calling this action receives the checkout token as a secret, but when that
# parameter is not supplied, the runner sets the value of that secret to empty string, which is passed on to this
# action, thus the default value of the parameter will not be applied. Related bugreport:
# https://github.com/actions/runner/issues/924
- name: Set Checkout Token
shell: pwsh
env:
CHECKOUT_TOKEN: ${{ inputs.token }}
run: |
$checkoutToken = $Env:CHECKOUT_TOKEN ? $Env:CHECKOUT_TOKEN : "${{ github.token }}"
"CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV

- uses: actions/[email protected]
with:
submodules: 'recursive'
token: ${{ inputs.token }}
submodules: "recursive"
token: ${{ env.CHECKOUT_TOKEN }}
10 changes: 1 addition & 9 deletions .github/workflows/build-and-test-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,10 @@ jobs:
- ${{ inputs.timeout-minutes }}
timeout-minutes: ${{ matrix.timeout-minutes }}
steps:
- name: Set Checkout Token
shell: pwsh
env:
CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
run: |
$checkoutToken = $Env:CHECKOUT_TOKEN ? $Env:CHECKOUT_TOKEN : "${{ github.token }}"
"CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV

- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ env.CHECKOUT_TOKEN }}
token: ${{ secrets.CHECKOUT_TOKEN }}

- name: Set up .NET
uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/build-and-test-orchard-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,18 +153,10 @@ jobs:
- ${{ inputs.timeout-minutes }}
timeout-minutes: ${{ matrix.timeout-minutes }}
steps:
- name: Set Checkout Token
shell: pwsh
env:
CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
run: |
$checkoutToken = $Env:CHECKOUT_TOKEN ? $Env:CHECKOUT_TOKEN : "${{ github.token }}"
"CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV

- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ env.CHECKOUT_TOKEN }}
token: ${{ secrets.CHECKOUT_TOKEN }}

- name: Set up .NET
uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ name: Build .NET solution

on:
workflow_call:
secrets:
CHECKOUT_TOKEN:
required: false
description: >
The GitHub token to authenticate checkout. Pass in a GitHub personal access token if authenticated submodules
are used.

inputs:
cancel-workflow-on-failure:
description: When set to "true", will cancel the current workflow run with all jobs if this workflow fails.
Expand Down Expand Up @@ -96,6 +103,8 @@ jobs:

- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ secrets.CHECKOUT_TOKEN }}

- name: Set up .NET
uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/deploy-to-azure-app-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ name: Deploy to Azure App Service
on:
workflow_call:
secrets:
CHECKOUT_TOKEN:
Piedone marked this conversation as resolved.
Show resolved Hide resolved
required: false
description: >
The GitHub token to authenticate checkout. Pass in a GitHub personal access token if authenticated submodules
are used.
AZURE_APP_SERVICE_DEPLOYMENT_SERVICE_PRINCIPAL:
required: true
AZURE_APP_SERVICE_PUBLISH_PROFILE:
required: true

inputs:
cancel-workflow-on-failure:
description: When set to "true", will cancel the current workflow run with all jobs if this workflow fails.
Expand Down Expand Up @@ -124,6 +130,8 @@ jobs:
steps:
- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ secrets.CHECKOUT_TOKEN }}

- name: Set up .NET
uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/msbuild-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,10 @@ jobs:
name: Build and Test
timeout-minutes: ${{ inputs.timeout-minutes }}
steps:
- name: Set Checkout Token
shell: pwsh
env:
CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
run: |
$checkoutToken = $Env:CHECKOUT_TOKEN ? $Env:CHECKOUT_TOKEN : "${{ github.token }}"
"CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV

- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ env.CHECKOUT_TOKEN }}
token: ${{ secrets.CHECKOUT_TOKEN }}

- name: Enable Node corepack
uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ name: Publish to NuGet

on:
workflow_call:
secrets:
CHECKOUT_TOKEN:
required: false
description: >
The GitHub token to authenticate checkout. Pass in a GitHub personal access token if authenticated submodules
are used.
# We can't access org secrets here so they need to be passed in.
API_KEY:
required: true

inputs:
cancel-workflow-on-failure:
description: When set to "true", will cancel the current workflow run with all jobs if this workflow fails.
Expand Down Expand Up @@ -47,10 +57,6 @@ on:
description: >
The desired NuGet package version used for publishing. If not specified, the GITHUB_REF_NAME environment
variable is used which is suitable if the version is derived from a git tag.
secrets:
# We can't access org secrets here so they need to be passed in.
API_KEY:
required: true

jobs:
publish-nuget:
Expand All @@ -64,6 +70,8 @@ jobs:
steps:
- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ secrets.CHECKOUT_TOKEN }}

- name: Set up .NET
uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,10 @@ jobs:
name: Check Spelling
runs-on: ubuntu-22.04
steps:
- name: Set Checkout Token
shell: pwsh
env:
CHECKOUT_TOKEN: ${{ secrets.CHECKOUT_TOKEN }}
run: |
$checkoutToken = $Env:CHECKOUT_TOKEN ? $Env:CHECKOUT_TOKEN : "${{ github.token }}"
"CHECKOUT_TOKEN=$checkoutToken" >> $Env:GITHUB_ENV

- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ env.CHECKOUT_TOKEN }}
token: ${{ secrets.CHECKOUT_TOKEN }}

# This is a workaround for the spelling workflow to check submodules too in the repository.
- name: Stub repo layout
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/test-analysis-failure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ name: Test Analysis Failure

on:
workflow_call:
secrets:
CHECKOUT_TOKEN:
required: false
description: >
The GitHub token to authenticate checkout. Pass in a GitHub personal access token if authenticated submodules
are used.

inputs:
cancel-workflow-on-failure:
description: When set to "true", will cancel the current workflow run with all jobs if this workflow fails.
Expand Down Expand Up @@ -81,6 +88,8 @@ jobs:
steps:
- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ secrets.CHECKOUT_TOKEN }}

- name: Set up .NET
uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev
Expand Down