-
Notifications
You must be signed in to change notification settings - Fork 27
68 lines (57 loc) · 2.16 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
66
67
68
on:
workflow_dispatch:
schedule:
- cron: "0 9 1 * *"
env:
GO_VERSION: "1.21"
GIT_AUTHOR_NAME: github-actions
GIT_AUTHOR_EMAIL: github-actions@github.com
GITHUB_UNPRIV_USERNAME: ${{ secrets.GOVUK_PAAS_UNPRIVILEGED_BOT_USERNAME }}
jobs:
generate-buildpack-bump-pr:
runs-on: ubuntu-latest
steps:
## Setup
- name: Checkout repo
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
submodules: true
# auth will be retained by repo configuration
token: ${{ secrets.GOVUK_PAAS_UNPRIVILEGED_BOT_PAT }}
- name: Install gettext
run: |
sudo apt install gettext
# for envsubst
- name: "Install Go ${{env.GO_VERSION}}"
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
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 remote add unpriv-fork "https://github.com/${GITHUB_UNPRIV_USERNAME}/paas-cf.git"
git checkout -b "$NEW_BRANCH_NAME"
git add config/buildpacks.yml
git add config/buildpacks.rolling.yml
git commit -m 'bump buildpacks'
git push unpriv-fork "$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 "$GITHUB_UNPRIV_USERNAME:$NEW_BRANCH_NAME" \
--title "Buildpack upgrades, $(date -u '+%B %Y')" \
--body-file "$FINAL_BODY"