Repository navigation
Expand file tree
/
Copy pathfix-and-commit.yml
More file actions
69 lines (60 loc) · 2.35 KB
/
Copy pathfix-and-commit.yml
File metadata and controls
69 lines (60 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Reproject datasets in place and open a pull request with the result.
#
# Runs in fix mode against the default branch on a schedule and on demand.
# Datasets carrying an unresolvable problem (missing CRS, no transformation
# path, a missing datum-shift grid, a rotated raster) are never rewritten on a
# guess, so a green run here means every change was safe to make.
#
# Copy to .github/workflows/crs-fix.yml in your repository.
name: CRS fix
on:
schedule:
- cron: "0 4 * * 1" # Mondays, 04:00 UTC
workflow_dispatch:
inputs:
target-crs:
description: "CRS to normalize everything to"
required: false
default: "EPSG:4326"
permissions:
contents: write
pull-requests: write
jobs:
fix:
name: Normalize CRS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Normalize CRS in place
id: crs
# Exit code 2 means files changed, which is the outcome we want to act
# on rather than treat as a failure.
continue-on-error: true
uses: geospatial-etl/crs-normalize-action@v1
with:
paths: data
target-crs: ${{ inputs.target-crs || 'EPSG:4326' }}
mode: fix
# Categorical rasters must not be interpolated; use bilinear or cubic
# only for continuous surfaces such as elevation.
resampling: nearest
# Refuse any datum shift declared as worse than one metre.
max-transform-error: "1.0"
fail-on: unresolvable
- name: Stop if anything was unresolvable
if: steps.crs.outputs.status == 'failed'
run: |
echo "Some datasets could not be normalized safely. See the job summary."
exit 1
- name: Open a pull request with the reprojected data
if: steps.crs.outputs.status == 'changed'
uses: peter-evans/create-pull-request@v6
with:
branch: automated/crs-normalize
delete-branch: true
title: "Normalize CRS to ${{ inputs.target-crs || 'EPSG:4326' }}"
commit-message: "Normalize CRS to ${{ inputs.target-crs || 'EPSG:4326' }}"
body: |
Automated reprojection of ${{ steps.crs.outputs.files-changed }} dataset(s).
CRS present before this change: `${{ steps.crs.outputs.crs-histogram }}`
Datasets with unresolvable CRS problems were left untouched.