Skip to content

Commit 3418119

Browse files
authored
Auto-merge tzdb updates (#819)
1 parent 6c95155 commit 3418119

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

.github/workflows/tzdbupdate.yml

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@ on:
99
workflow_dispatch:
1010

1111
permissions:
12-
contents: write # to create branch and push
13-
pull-requests: write # to create a PR
12+
contents: read
1413

1514
jobs:
1615
tzdbcheck:
16+
permissions:
17+
contents: write # for peter-evans/create-pull-request to create branch
18+
pull-requests: write # for peter-evans/create-pull-request to create a PR
1719
runs-on: ubuntu-latest
18-
env:
19-
MAVEN_ARGS: -e -B -ntp -DtrimStackTrace=false
20-
2120
steps:
2221
- name: Checkout
2322
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
2423
with:
2524
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
25+
fetch-tags: true
26+
27+
- name: Setup git
28+
run: |
29+
git config --global user.name "Stephen Colebourne (CI)"
30+
git config --global user.email "scolebourne@joda.org"
2631
2732
- name: Set up JDK
2833
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 #v4.7.0
@@ -33,6 +38,13 @@ jobs:
3338

3439
- name: Maven version
3540
run: |
41+
mkdir -p ./.mvn
42+
echo "-e" >> ./.mvn/maven.config
43+
echo "-B" >> ./.mvn/maven.config
44+
echo "-ntp" >> ./.mvn/maven.config
45+
echo "-DtrimStackTrace=false" >> ./.mvn/maven.config
46+
echo "--settings" >> ./.mvn/maven.config
47+
echo "$( pwd )/.github/maven-settings.xml" >> ./.mvn/maven.config
3648
mvn --version
3749
mkdir -p target
3850
@@ -85,7 +97,6 @@ jobs:
8597
- name: Update build with new tzdb
8698
if: env.NOOP != 'true'
8799
run: |
88-
sed -i 's/$CURRENT_TZDB/${LATEST_TZDB}/g' src/main/java/org/joda/time/tz/src/Readme.txt
89100
mvn versions:set-property -DnewVersion=${LATEST_TZDB} -Dproperty=tz.database.version -DgenerateBackupPoms=false
90101
mvn install
91102
@@ -104,3 +115,15 @@ jobs:
104115
assignees: jodastephen
105116
labels: TZDB
106117
branch: bot/update-tzdb
118+
119+
- name: Auto-merge the Pull Request
120+
if: steps.createpr.outputs.pull-request-number
121+
run: gh pr merge --squash --auto "${{ steps.createpr.outputs.pull-request-number }}"
122+
env:
123+
GH_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
124+
125+
- name: Delete tzdb tag
126+
if: env.NOOP != 'true' && startsWith(github.ref, 'refs/tags/tzdb')
127+
run: |
128+
git tag --delete "${GITHUB_REF_NAME}" || true
129+
git push --delete origin "${GITHUB_REF_NAME}" || true

0 commit comments

Comments
 (0)