fix(ci): split up checkout steps for push vs. pull request (#3911)

This commit is contained in:
Gabe Kangas 2024-09-05 13:50:59 -07:00 committed by GitHub
parent 90b70612c9
commit 89a33ea4e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 132 additions and 31 deletions

View file

@ -13,7 +13,15 @@ jobs:
name: GitHub actions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- uses: docker://rhysd/actionlint:latest
with:

View file

@ -18,8 +18,15 @@ jobs:
with:
concurrent_skipping: 'same_content_newer'
- name: Checkout repository
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Get changed files
id: changed-files-yaml

View file

@ -19,8 +19,15 @@ jobs:
with:
concurrent_skipping: 'same_content_newer'
- name: Checkout
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- uses: actions/setup-node@v4
with:

View file

@ -11,8 +11,15 @@ jobs:
if: github.repository == 'owncast/owncast'
steps:
- name: Checkout
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Cache node modules
uses: actions/cache@v4

View file

@ -28,13 +28,15 @@ jobs:
with:
concurrent_skipping: 'same_content_newer'
- name: Check out code
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Get changed files
id: changed-files-yaml

View file

@ -36,8 +36,15 @@ jobs:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- uses: actions/setup-go@v5
with:

View file

@ -19,7 +19,15 @@ jobs:
container:
image: aquasec/trivy
steps:
- uses: actions/checkout@v4
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Check critical issues
run: trivy config --exit-code 1 --severity "HIGH,CRITICAL" ./Dockerfile

View file

@ -37,10 +37,15 @@ jobs:
image: tonistiigi/binfmt:latest
platforms: all
- name: Checkout repo
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Build and push
if: ${{ github.event_name == 'schedule' && env.GH_CR_PAT != null }}

View file

@ -16,8 +16,15 @@ jobs:
working-directory: ./web
steps:
- name: Checkout repository
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Get changed files
id: changed-files-yaml

View file

@ -9,8 +9,15 @@ jobs:
name: Generate API Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repo
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Run redoc on openapi.yaml
run: |

View file

@ -25,8 +25,15 @@ jobs:
with:
concurrent_skipping: 'same_content_newer'
- name: Checkout repository
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Get changed files
id: changed-files-yaml

View file

@ -28,14 +28,15 @@ jobs:
cancel_others: 'true'
skip_after_successful_duplicate: 'true'
- name: Checkout
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
persist-credentials: true
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Get changed files
id: changed-files-yaml
@ -101,13 +102,15 @@ jobs:
cancel_others: 'true'
skip_after_successful_duplicate: 'true'
- name: Checkout
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Cache node modules
uses: actions/cache@v4
@ -155,13 +158,15 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Checkout
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Bundle web app (next.js build)
run: build/web/bundleWeb.sh

View file

@ -17,8 +17,15 @@ jobs:
with:
concurrent_skipping: 'same_content_newer'
- name: Checkout
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- uses: actions/setup-node@v4
with:

View file

@ -14,7 +14,16 @@ jobs:
Screenshots:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- uses: actions/setup-go@v5
with:
go-version: '1.22'

View file

@ -20,7 +20,15 @@ jobs:
container:
image: docker.io/ubuntu:24.04
steps:
- uses: actions/checkout@v4
- name: Check out pull request code
uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Check out repository code
uses: actions/checkout@v4
if: github.event_name == 'push'
- name: Install shellcheck
run: apt update && apt install -y shellcheck bash && shellcheck --version