ci: Updating actions/checkout to v4 and defaulting to fetch-depth 1 instead of 0 (#29281)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated GitHub Actions workflows to use `actions/checkout@v4` for
improved performance and reliability.
- Removed `fetch-depth` parameter to simplify checkout steps across
various workflows.
  - Standardized quote usage for consistency in workflow files.

- **Documentation**
- Adjusted formatting and descriptions in workflow files for better
clarity and readability.

- **Refactor**
- Aligned multiple workflow files to follow a consistent structure and
naming convention.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

fetch-depth 0 causes the Github workflow to checkout the entire Git
history. This is not required. We only need to check out the head of the
commit. By default, actions/checkout has fetch-depth=1, hence removing
it from the workflow completely for simplicity.
This commit is contained in:
Arpit Mohan 2023-12-05 13:44:43 +05:30 committed by GitHub
parent 3daa0a04a5
commit 2650ea161d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 115 additions and 177 deletions

View File

@ -13,8 +13,7 @@ jobs:
steps:
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: View issue information
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
@ -37,8 +36,7 @@ jobs:
steps:
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: View issue information
env:
GITHUB_CONTEXT: ${{ toJson(github) }}

View File

@ -62,7 +62,7 @@ jobs:
steps:
# Check out merge commit
- name: Checkout Branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
@ -142,7 +142,7 @@ jobs:
if: success()
steps:
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
@ -196,5 +196,3 @@ jobs:
--data ' {
"status": "FAILED"
}'

View File

@ -39,17 +39,14 @@ jobs:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ inputs.pr }}/merge
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Figure out the PR number
run: echo ${{ inputs.pr }}
@ -97,7 +94,6 @@ jobs:
echo "appsmithctl_run_result=failed" >> $GITHUB_OUTPUT > ~/appsmithctl_run_result
exit 1;
# Set status = success
- name: Save the status of the run
run: echo "appsmithctl_run_result=success" >> $GITHUB_OUTPUT > ~/appsmithctl_run_result

View File

@ -1,16 +1,16 @@
name: 'Build Storybook - UI Tests with Chromatic'
name: "Build Storybook - UI Tests with Chromatic"
on:
push:
branches:
- release
paths:
- 'app/client/packages/design-system/**'
- 'app/client/packages/storybook/**'
- "app/client/packages/design-system/**"
- "app/client/packages/storybook/**"
pull_request:
paths:
- 'app/client/packages/design-system/**'
- 'app/client/packages/storybook/**'
- "app/client/packages/design-system/**"
- "app/client/packages/storybook/**"
jobs:
chromatic-deployment:
@ -19,16 +19,14 @@ jobs:
steps:
- name: Checkout PR if pull_request event
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Checkout PR if push event
if: github.event_name == 'push'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: release
- name: Use Node.js

View File

@ -24,9 +24,7 @@ jobs:
matrix_count: ${{steps.matrix.outputs.matrix_count}}
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Set matrix jobs
id: matrix

View File

@ -26,17 +26,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Download the client build artifact
if: steps.run_result.outputs.run_result != 'success'

View File

@ -1,16 +1,16 @@
name: 'Build Storybook - Docs with Chromatic'
name: "Build Storybook - Docs with Chromatic"
on:
push:
branches:
- release
paths:
- 'app/client/packages/design-system/**'
- 'app/client/packages/storybook/**'
- "app/client/packages/design-system/**"
- "app/client/packages/storybook/**"
pull_request:
paths:
- 'app/client/packages/design-system/**'
- 'app/client/packages/storybook/**'
- "app/client/packages/design-system/**"
- "app/client/packages/storybook/**"
jobs:
chromatic-deployment:
@ -19,16 +19,14 @@ jobs:
steps:
- name: Checkout PR if pull_request event
if: github.event_name == 'pull_request'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Checkout PR if push event
if: github.event_name == 'push'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: release
- name: Use Node.js

View File

@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
run_id:
description: 'Run id to download artifacts:'
description: "Run id to download artifacts:"
required: true
type: number
@ -40,9 +40,7 @@ jobs:
uses: depot/setup-action@v1
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Download Docker image artifact
uses: dawidd6/action-download-artifact@v2

View File

@ -43,17 +43,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
# Timestamp will be used to create cache key
- id: timestamp

View File

@ -43,17 +43,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
# Timestamp will be used to create cache key
- id: timestamp

View File

@ -119,17 +119,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
# Timestamp will be used to create cache key
- id: timestamp

View File

@ -53,17 +53,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0 || github.event_name == 'schedule'
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
# Timestamp will be used to create cache key
- id: timestamp

View File

@ -80,17 +80,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
# Timestamp will be used to create cache key
- id: timestamp

View File

@ -115,17 +115,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
# Timestamp will be used to create cache key
- id: timestamp

View File

@ -53,17 +53,14 @@ jobs:
# Check out merge commit
- name: Fork based /ok-to-test checkout
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "refs/pull/${{ inputs.pr }}/merge"
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
# Timestamp will be used to create cache key
- id: timestamp

View File

@ -11,8 +11,6 @@ jobs:
steps:
# Checkout the code
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install mongosh
run: |

View File

@ -54,24 +54,24 @@ jobs:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: refs/pull/${{ inputs.pr }}/merge
# Check out the specified branch in case this workflow is called by another workflow
- name: Checkout the specified branch
if: inputs.pr == 0 && inputs.branch != ''
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-tags: true
ref: ${{ inputs.branch }}
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0 && inputs.branch == ''
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
fetch-tags: true
# get all the files changes in the cypress/e2e folder
- name: Get added files in cypress/e2e folder

View File

@ -33,9 +33,8 @@ jobs:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ inputs.pr }}/merge
# In case this is second attempt try restoring status of the prior attempt from cache

View File

@ -24,7 +24,7 @@ jobs:
steps:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: refs/pull/${{ inputs.pr }}/merge

View File

@ -33,9 +33,8 @@ jobs:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ inputs.pr }}/merge
# In case this is second attempt try restoring status of the prior attempt from cache

View File

@ -22,8 +22,6 @@ jobs:
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to DockerHub
uses: docker/login-action@v3

View File

@ -53,9 +53,7 @@ jobs:
steps:
# Checkout the code
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
@ -114,15 +112,13 @@ jobs:
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
distribution: "temurin"
java-version: "17"
# Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again
- name: Cache maven dependencies
@ -163,9 +159,7 @@ jobs:
steps:
# Checkout the code
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
@ -216,7 +210,7 @@ jobs:
steps:
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Depot CLI
uses: depot/setup-action@v1

View File

@ -22,9 +22,7 @@ jobs:
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Setup Helm
uses: azure/setup-helm@v1

View File

@ -59,7 +59,7 @@ jobs:
steps:
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
@ -121,7 +121,7 @@ jobs:
steps:
# Check out merge commit
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
@ -201,10 +201,9 @@ jobs:
if: success()
steps:
- name: Checkout PR
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
fetch-depth: 0
- name: Print versions of tools
run: |

View File

@ -1,6 +1,4 @@
---
name: Ami Packer Build
on:
@ -9,13 +7,12 @@ on:
jobs:
packer:
runs-on: ubuntu-latest
name: ami-packer-build
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
@ -27,7 +24,7 @@ jobs:
- name: Install python
uses: actions/setup-python@v3
with:
python-version: '3.8'
python-version: "3.8"
- name: Install ansible
run: pip install ansible

View File

@ -43,17 +43,14 @@ jobs:
steps:
- name: Checkout the merged commit from PR and base branch
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ inputs.pr }}/merge
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Figure out the PR number
run: echo ${{ inputs.pr }}
@ -198,7 +195,7 @@ jobs:
echo ref=$ref >> $GITHUB_OUTPUT
- name: Checkout Performance Infra code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: appsmithorg/performance-infra
token: ${{ secrets.APPSMITH_PERF_INFRA_REPO_PAT }}

View File

@ -25,10 +25,6 @@ jobs:
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'repository_dispatch'
defaults:
run:
working-directory: app/client
shell: bash
strategy:
fail-fast: false
@ -51,17 +47,14 @@ jobs:
steps:
- name: Checkout the merged commit from PR and base branch
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ inputs.pr }}/merge
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Figure out the PR number
run: echo ${{ inputs.pr }}
@ -189,7 +182,7 @@ jobs:
echo ref=$ref >> $GITHUB_OUTPUT
- name: Checkout Performance Infra code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: appsmithorg/performance-infra
token: ${{ secrets.APPSMITH_PERF_INFRA_REPO_PAT }}

View File

@ -46,17 +46,14 @@ jobs:
steps:
- name: Checkout the merged commit from PR and base branch
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/pull/${{ inputs.pr }}/merge
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4
- name: Figure out the PR number
run: echo ${{ inputs.pr }}
@ -184,7 +181,7 @@ jobs:
echo ref=$ref >> $GITHUB_OUTPUT
- name: Checkout Performance Infra code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: appsmithorg/performance-infra
token: ${{ secrets.APPSMITH_PERF_INFRA_REPO_PAT }}

View File

@ -13,7 +13,7 @@ jobs:
steps:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
@ -84,7 +84,15 @@ jobs:
qc-result:
name: qc-result
needs: [server-spotless, server-unit-tests, client-build, client-prettier, client-unit-tests, client-lint]
needs:
[
server-spotless,
server-unit-tests,
client-build,
client-prettier,
client-unit-tests,
client-lint,
]
if: always()
runs-on: ubuntu-latest
defaults:

View File

@ -48,25 +48,25 @@ jobs:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
if: inputs.pr != 0
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: refs/pull/${{ inputs.pr }}/merge
# Check out the specified branch in case this workflow is called by another workflow
- name: Checkout the specified branch
if: inputs.pr == 0 && inputs.branch != ''
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-tags: true
ref: ${{ inputs.branch }}
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Checkout the head commit of the branch
if: inputs.pr == 0 && inputs.branch == ''
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Figure out the PR number
run: echo ${{ inputs.pr }}

View File

@ -44,25 +44,26 @@ jobs:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Check out merged commit from PR and base branch
uses: actions/checkout@v3
uses: actions/checkout@v4
if: inputs.pr != 0
with:
fetch-depth: 0
fetch-tags: true
ref: refs/pull/${{ inputs.pr }}/merge
# Check out the specified branch in case this workflow is called by another workflow
- name: Checkout the specified branch
if: inputs.pr == 0 && inputs.branch != ''
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-tags: true
ref: ${{ inputs.branch }}
# Checkout the code in the current branch in case the workflow is called because of a branch push event
- name: Check out the head commit of the branch
uses: actions/checkout@v3
uses: actions/checkout@v4
if: inputs.pr == 0 && inputs.branch == ''
with:
fetch-depth: 0
fetch-tags: true
- name: Figure out the PR number
run: echo ${{ inputs.pr }}
@ -92,8 +93,8 @@ jobs:
if: steps.run_result.outputs.run_result != 'success'
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
distribution: "temurin"
java-version: "17"
# Retrieve maven dependencies from cache. After a successful run, these dependencies are cached again
- name: Cache maven dependencies

View File

@ -20,7 +20,7 @@ jobs:
steps:
# Check out merge commit with the base branch in case this workflow is invoked via pull request
- name: Checkout the merged commit from PR and base branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: refs/pull/${{ inputs.pr }}/merge
@ -28,8 +28,8 @@ jobs:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
distribution: "temurin"
java-version: "17"
# Run maven step for spotless check
- name: Run spotless check

View File

@ -188,7 +188,7 @@ jobs:
steps:
- name: Checkout the head commit of the branch
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download the react build artifact
uses: actions/download-artifact@v3
@ -263,7 +263,7 @@ jobs:
steps:
- name: Checkout the head commit of the branch
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download the react build artifact
uses: actions/download-artifact@v3