Skip to content

Commit b955261

Browse files
Migrate GitHub Actions workflows to Node.js 24 (#165)
* Upgrade Node24-ready GitHub actions * Upgrade upload-artifact action to v7 * Update Node24 actions migration plans * Replace dashboard publish actions with git push script * Upgrade to Node 24 actions * Re-apply copier templates * Clean up
1 parent 4839895 commit b955261

30 files changed

Lines changed: 151 additions & 145 deletions

.copier-answers.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WARNING: Do not edit this file manually.
22
# Any changes will be overwritten by Copier.
3-
_commit: v0.10.1-41-g508666e
3+
_commit: v0.11.0-7-gb5113cf
44
_src_path: gh:easyscience/templates
55
app_docs_url: https://easyscience.github.io/diffraction-app
66
app_doi: 10.5281/zenodo.18163581
@@ -17,9 +17,8 @@ lib_python_min: '3.12'
1717
lib_repo_name: diffraction-lib
1818
project_contact_email: support@easydiffraction.org
1919
project_copyright_years: 2021-2026
20-
project_extended_description: A software for calculating neutron powder diffraction
21-
patterns based on a structural model and refining its parameters against experimental
22-
data
20+
project_extended_description: A software for calculating diffraction patterns based
21+
on a structural model and refining its parameters against experimental data
2322
project_name: EasyDiffraction
2423
project_short_description: Diffraction data analysis
2524
project_shortcut: ED

.github/actions/download-artifact/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Download artifact'
2-
description: 'Generic wrapper for actions/download-artifact'
2+
description: 'Wrapper for actions/download-artifact'
33
inputs:
44
name:
55
description: 'Name of the artifact to download'
@@ -39,7 +39,7 @@ runs:
3939
using: 'composite'
4040
steps:
4141
- name: Download artifact
42-
uses: actions/download-artifact@v4
42+
uses: actions/download-artifact@v8
4343
with:
4444
name: ${{ inputs.name }}
4545
path: ${{ inputs.path }}

.github/actions/github-script/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inputs:
1313
runs:
1414
using: 'composite'
1515
steps:
16-
- uses: actions/github-script@v8
16+
- uses: actions/github-script@v9
1717
with:
1818
script: ${{ inputs.script }}
1919
github-token: ${{ inputs.github-token }}

.github/actions/setup-easyscience-bot/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ runs:
2222
steps:
2323
- name: Create GitHub App installation token
2424
id: app-token
25-
uses: actions/create-github-app-token@v2
25+
uses: actions/create-github-app-token@v3
2626
with:
27-
app-id: ${{ inputs.app-id }}
27+
client-id: ${{ inputs.app-id }}
2828
private-key: ${{ inputs.private-key }}
2929
repositories: ${{ inputs.repositories }}
3030

.github/actions/setup-pixi/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Setup Pixi Environment'
2-
description: 'Sets up pixi with common configuration'
2+
description: 'Wrapper for prefix-dev/setup-pixi'
33
inputs:
44
environments:
55
description: 'Pixi environments to setup'

.github/actions/upload-artifact/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Upload artifact'
2-
description: 'Generic wrapper for actions/upload-artifact'
2+
description: 'Wrapper for actions/upload-artifact'
33
inputs:
44
name:
55
description: 'Artifact name'
@@ -38,7 +38,7 @@ runs:
3838
using: 'composite'
3939
steps:
4040
- name: Upload artifact
41-
uses: actions/upload-artifact@v4
41+
uses: actions/upload-artifact@v7
4242
with:
4343
name: ${{ inputs.name }}
4444
path: ${{ inputs.path }}

.github/actions/upload-codecov/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Upload coverage to Codecov'
2-
description: 'Generic wrapper for codecov/codecov-action@v5'
2+
description: 'Wrapper for codecov/codecov-action'
33

44
inputs:
55
name:
@@ -32,7 +32,7 @@ inputs:
3232
runs:
3333
using: composite
3434
steps:
35-
- uses: codecov/codecov-action@v5
35+
- uses: codecov/codecov-action@v6
3636
with:
3737
name: ${{ inputs.name }}
3838
flags: ${{ inputs.flags }}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
remote_repository="${DASHBOARD_REMOTE_REPOSITORY:?}"
6+
publish_branch="${DASHBOARD_PUBLISH_BRANCH:-master}"
7+
source_dir="${DASHBOARD_SOURCE_DIR:?}"
8+
token="${DASHBOARD_TOKEN:?}"
9+
git_user_name="${DASHBOARD_GIT_USER_NAME:-easyscience[bot]}"
10+
git_user_email="${DASHBOARD_GIT_USER_EMAIL:?}"
11+
commit_message="${DASHBOARD_COMMIT_MESSAGE:?}"
12+
max_attempts="${DASHBOARD_PUSH_ATTEMPTS:-3}"
13+
delay_seconds="${DASHBOARD_PUSH_DELAY_SECONDS:-15}"
14+
15+
workspace_dir="$(mktemp -d)"
16+
repo_dir="${workspace_dir}/dashboard"
17+
remote_url="https://x-access-token:${token}@github.com/${remote_repository}.git"
18+
19+
cleanup() {
20+
rm -rf "${workspace_dir}"
21+
}
22+
23+
prepare_worktree() {
24+
if [[ ! -d "${repo_dir}/.git" ]]; then
25+
git clone --branch "${publish_branch}" --depth 1 "${remote_url}" "${repo_dir}"
26+
else
27+
git -C "${repo_dir}" fetch origin "${publish_branch}"
28+
git -C "${repo_dir}" checkout "${publish_branch}"
29+
git -C "${repo_dir}" reset --hard "origin/${publish_branch}"
30+
git -C "${repo_dir}" clean -fd
31+
fi
32+
33+
git -C "${repo_dir}" config user.name "${git_user_name}"
34+
git -C "${repo_dir}" config user.email "${git_user_email}"
35+
}
36+
37+
sync_publish_dir() {
38+
cp -R "${source_dir}/." "${repo_dir}/"
39+
git -C "${repo_dir}" add .
40+
41+
if git -C "${repo_dir}" diff --cached --quiet; then
42+
return 1
43+
fi
44+
45+
git -C "${repo_dir}" commit -m "${commit_message}"
46+
}
47+
48+
trap cleanup EXIT
49+
50+
prepare_worktree
51+
52+
if ! sync_publish_dir; then
53+
echo "No dashboard changes to publish."
54+
exit 0
55+
fi
56+
57+
for ((attempt = 1; attempt <= max_attempts; attempt += 1)); do
58+
if git -C "${repo_dir}" push origin "HEAD:${publish_branch}"; then
59+
echo "Dashboard published on attempt ${attempt}."
60+
exit 0
61+
fi
62+
63+
if ((attempt == max_attempts)); then
64+
echo "Dashboard publish failed after ${max_attempts} attempts." >&2
65+
exit 1
66+
fi
67+
68+
echo "Dashboard push attempt ${attempt} failed. Retrying in ${delay_seconds}s." >&2
69+
sleep "${delay_seconds}"
70+
71+
prepare_worktree
72+
73+
if ! sync_publish_dir; then
74+
echo "Dashboard changes already exist in the target repository."
75+
exit 0
76+
fi
77+
done

.github/workflows/backmerge.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,14 @@ concurrency:
2020
group: backmerge-master-into-develop
2121
cancel-in-progress: false
2222

23-
# Opt into Node.js 24 for all JavaScript actions.
24-
# Remove once all referenced actions natively target Node 24.
25-
env:
26-
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
27-
2823
jobs:
2924
backmerge:
3025
runs-on: ubuntu-latest
3126
timeout-minutes: 10
3227

3328
steps:
3429
- name: Checkout repository (for local actions)
35-
uses: actions/checkout@v5
30+
uses: actions/checkout@v6
3631

3732
- name: Setup easyscience[bot]
3833
id: bot
@@ -43,7 +38,7 @@ jobs:
4338
repositories: ${{ github.event.repository.name }}
4439

4540
- name: Checkout repository (with bot token)
46-
uses: actions/checkout@v5
41+
uses: actions/checkout@v6
4742
with:
4843
fetch-depth: 0
4944
token: ${{ steps.bot.outputs.token }}

.github/workflows/cleanup.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ on:
1515
days:
1616
description: 'Number of days.'
1717
required: true
18-
default: 30
18+
default: '30'
1919
minimum_runs:
2020
description: 'The minimum runs to keep for each workflow.'
2121
required: true
22-
default: 6
22+
default: '6'
2323
delete_workflow_pattern:
2424
description:
2525
'The name or filename of the workflow. if not set then it will target all
@@ -61,11 +61,6 @@ on:
6161
- 'false'
6262
- 'true'
6363

64-
# Opt into Node.js 24 for all JavaScript actions.
65-
# Remove once all referenced actions natively target Node 24.
66-
env:
67-
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
68-
6964
jobs:
7065
del-runs:
7166
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)