Do not checkout the website repository twice in update.yml (#271)

This is good because checking out a non-existing branch:

- takes nearly 30s, and most PR does not have a branch with the same name declared in both release-data and endoflife.date repository,
- pollute workflow summary with cryptic error messages.

So overall this save a lot of time and is cleaner.
This commit is contained in:
Marc Wrobel
2023-12-31 17:11:45 +01:00
committed by GitHub
parent f6a8349c46
commit 727c1c7367

View File

@@ -28,40 +28,41 @@ jobs:
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.cache path: ~/.cache
# The cache is reset on the first build of every week this way. # The cache is reset on the first build of every week this way. If you wish to reset the cache manually,
# Change the -1 part if you need to force reset the cache # you can do it on https://github.com/endoflife-date/release-data/actions/caches or by updating
# the last part of the key below.
key: "${{ steps.current-time.outputs.formattedTime }}-2" key: "${{ steps.current-time.outputs.formattedTime }}-2"
- uses: actions/checkout@v4 - name: Clone self repository
name: Clone self repository uses: actions/checkout@v4
with: with:
ref: ${{ github.head_ref }} ref: ${{ github.head_ref }}
- uses: actions/checkout@v4 - name: Clone website repository
id: clone_same_branch uses: actions/checkout@v4
name: Clone website (Same Branch)
continue-on-error: true
with: with:
repository: endoflife-date/endoflife.date repository: endoflife-date/endoflife.date
path: website path: website
submodules: false submodules: false
ref: ${{github.ref_name}} fetch-depth: 0 # fetch all history for all branches and tags, needed for next step
- uses: actions/checkout@v4 # This is useful for testing changes that require updates on both release-data and website repositories.
name: Clone website (Main) # This step must never fail because in most case the branch will not exist on the website repository.
if: steps.clone_same_branch.outcome != 'success' - name: Checkout the same branch on website
with: run: |
repository: endoflife-date/endoflife.date cd website
path: website git checkout --progress --force -B ${{ github.ref_name }} refs/remotes/origin/${{ github.ref_name }} || true
submodules: false
- uses: actions/setup-python@v5 - name: Setup Python
uses: actions/setup-python@v5
with: with:
python-version: '3.11' python-version: '3.11'
cache: 'pip' cache: 'pip'
- run: pip install -r requirements.txt
- name: Update data - name: Install Python dependencies
run: pip install -r requirements.txt
- name: Update release data
id: update_data id: update_data
env: env:
PYPPETEER_HOME: /home/runner/.cache/pyppeteer # Add chromium downloaded by pyppeteer to the cache. PYPPETEER_HOME: /home/runner/.cache/pyppeteer # Add chromium downloaded by pyppeteer to the cache.