forked from openjdk/shenandoah-jdk21u
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GHA automation to merge code from jdk21u-dev
- Loading branch information
1 parent
1482647
commit 7903f6d
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "Merge Latest Tag from Tip" | ||
on: | ||
schedule: | ||
- cron: '0 14 * * 4' | ||
workflow_dispatch: | ||
jobs: | ||
# To create personal access tokens, go to account settings, | ||
# then developer settings. Create a legacy token, give it | ||
# access to repos and workflows and other sensible things. | ||
# To then create a secret for the workflow, go to the | ||
# repository settings and create a new secret with the text | ||
# of the access token. | ||
merge-from-tip: | ||
# We only want this to run in one repo | ||
# if: github.repository == 'openjdk/shenandoah' | ||
runs-on: ubuntu-latest | ||
name: Merge latest tag | ||
steps: | ||
# Note that we are checking out the upstream fork here. | ||
# If this automation runs in openjdk/shenandoah, remove | ||
# the token and repository arguments. | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.WORKFLOWS }} | ||
repository: openjdk/shenandoah-jdk21u | ||
- name: Fetch latest tag | ||
id: latest-tag | ||
run: | | ||
git remote add upstream https://github.com/openjdk/jdk21u-dev.git | ||
git fetch upstream | ||
echo "latest=$(git tag --list --sort=-creatordate | head -1)" >> "$GITHUB_OUTPUT" | ||
- name: Reset the default branch with latest tag | ||
run: | | ||
git reset --hard ${{ steps.latest-tag.outputs.latest }} | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: Merge tag ${{ steps.latest-tag.outputs.latest }} | ||
# Using the legacy personal access token seems to be | ||
# required to create a pull request on a remote repo. | ||
# We can revert this to a fine grained token when this | ||
# workflow is running upstream. | ||
token: ${{ secrets.PAT }} | ||
branch: merge-${{ steps.latest-tag.outputs.latest }} | ||
delete-branch: true | ||
# Without this, this action will attempt to push the | ||
# new branch to the remote fork (i.e. openjdk/shenandoah). | ||
# When this workflow runs in that repo, we can remove this. | ||
push-to-fork: ${{ github.repository }} | ||
title: Merge openjdk/jdk21u-dev:master | ||
body: Merges tag ${{ steps.latest-tag.outputs.latest }} | ||
|