-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 2.1 KB
/
update-pangeo-dockerfile.yml
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
name: Update Dockerfile from Source
# For this to work, you must all actions to create PRs at the org level
on:
push:
branches:
- main
- dev
paths:
- '.github/workflows/update-pangeo-dockerfile.yml'
workflow_dispatch: # Manual trigger
schedule:
- cron: '0 3 * * *' # Runs daily at 3:00 AM UTC
jobs:
update-dockerfile:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }} # Base branch (main or dev)
- name: Fetch Raw Dockerfile
id: fetch_dockerfile
run: |
URL="https://raw.githubusercontent.com/pangeo-data/pangeo-docker-images/master/base-image/Dockerfile"
curl -o base-image/Dockerfile.temp $URL
# Strip everything after ENTRYPOINT and save it to a new file
awk '/ENTRYPOINT/ {print; exit} {print}' base-image/Dockerfile.temp > base-image/Dockerfile.new
rm base-image/Dockerfile.temp
# Compare the downloaded version with the existing Dockerfile
if cmp -s base-image/Dockerfile base-image/Dockerfile.new; then
echo "No changes in Dockerfile."
echo "changed=false" >> $GITHUB_ENV
rm base-image/Dockerfile.new
else
echo "Dockerfile has changed."
mv base-image/Dockerfile.new base-image/Dockerfile
echo "changed=true" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update base-image Dockerfile
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
branch: update-dockerfile
delete-branch: true
title: 'Update Dockerfile'
body: |
Update Pangeo base-image Dockerfile
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
assignees: eeholmes
reviewers: eeholmes
draft: false