-
Notifications
You must be signed in to change notification settings - Fork 27
65 lines (55 loc) · 1.79 KB
/
generate_buildpack_bump_pr.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
62
63
64
65
on:
workflow_dispatch:
schedule:
- cron: "0 9 1 * *"
permissions:
contents: write
env:
GO_VERSION: "1.20"
GIT_AUTHOR_NAME: github-actions
GIT_AUTHOR_EMAIL: [email protected]
jobs:
generate-buildpack-bump-pr:
runs-on: ubuntu-latest
steps:
## Setup
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: true
- name: Install gettext
run: |
sudo apt install gettext
# for envsubst
- name: "Install Go ${{env.GO_VERSION}}"
uses: actions/setup-go@v2
with:
go-version: "${{env.GO_VERSION}}"
- name: "Install yq"
run: |
go install github.com/mikefarah/yq/v4@5ef537f3fd1a9437aa3ee44c32c6459a126efdc4 # v4.34.1
- name: generate-buildpacks-yml
run: |
./scripts/update_buildpacks.sh
- name: Commit and push
run: |
export NEW_BRANCH_NAME="auto-bump-buildpacks-$(date -u '+%Y%m%dT%H%M')"
export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
git checkout -b "$NEW_BRANCH_NAME"
git add config/buildpacks.yml
git add config/buildpacks.rolling.yml
git commit -m 'bump buildpacks'
git push origin "$NEW_BRANCH_NAME"
echo "NEW_BRANCH_NAME=$NEW_BRANCH_NAME" >> $GITHUB_ENV
- name: Create PR
env:
GITHUB_TOKEN: ${{ secrets.GOVUK_PAAS_UNPRIVILEGED_BOT_PAT }}
run: |
FINAL_BODY=$(mktemp)
envsubst < ./.github/workflows/automatic_buildpack_bump_pr_body.md > $FINAL_BODY
gh pr create \
--base main \
--head "$NEW_BRANCH_NAME" \
--title "Buildpack upgrades, $(date -u '+%B %Y')" \
--body-file "$FINAL_BODY"