-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
95 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,95 @@ | ||
name: pkg-update | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
push: | ||
branches: | ||
- actions/trigger/pkg-update | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
# https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#push-using-ssh-deploy-keys | ||
|
||
- name: 'Merge master to create-pull-request/pkg-update' | ||
run: | | ||
base="master" | ||
target="create-pull-request/pkg-update" | ||
git_fetch_origin() { | ||
git fetch --unshallow origin "$1" || git fetch origin "$1" | ||
} | ||
set -ex | ||
if [ -n "$GITHUB_ACTOR" ] | ||
then | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "$GITHUB_ACTOR" | ||
fi | ||
git_fetch_origin "refs/heads/$base:refs/remotes/origin/$base" | ||
git checkout -B "$base" "origin/$base" | ||
git_fetch_origin "refs/heads/$target:refs/remotes/origin/$target" || exit 0 | ||
git checkout -B "$target" "origin/$target" | ||
git merge --strategy=ours --no-commit "$base" | ||
find . -type d -name .git -prune -o -type f -print0 | xargs --null rm -rf | ||
git checkout "$base" -- . | ||
git ls-tree -r --name-only "origin/$target" | grep -F Manifest.toml \ | ||
| xargs git checkout "origin/$target" -- | ||
git ls-tree -r --name-only "origin/$target" | grep -F Manifest.toml \ | ||
| xargs git add -f -- | ||
git add . | ||
git commit -m "Merge branch '$base'" || true | ||
# Since create-pull-request does not like when the current | ||
# branch is the target branch, checkout master. | ||
# https://github.com/JuliaFolds/Transducers.jl/pull/167 | ||
if [ "$(git rev-parse --abbrev-ref HEAD)" != "$base" ] | ||
then | ||
git checkout "$base" | ||
git merge --ff-only "$target" | ||
fi | ||
git ls-tree -r --name-only "origin/$base" | grep -F Manifest.toml \ | ||
| xargs git checkout "origin/$base" -- | ||
git ls-tree -r --name-only "origin/$base" | grep -F Manifest.toml \ | ||
| xargs git add -f -- | ||
# https://github.com/tkf/julia-update-manifests | ||
- name: Update */Manifest.toml | ||
uses: tkf/julia-update-manifests@v1 | ||
with: | ||
version: '1.4' | ||
projects: test/environments/main | ||
|
||
# https://github.com/peter-evans/create-pull-request | ||
# https://github.com/marketplace/actions/create-pull-request | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Update */Manifest.toml | ||
title: 'Update */Manifest.toml' | ||
body: | | ||
## Commit Message | ||
Update */Manifest.toml | ||
# When merging PR via Mergify using squash method, it can | ||
# create large commit message by listing titles of all | ||
# commits (default behavior of GitHub squash merge). | ||
# Overriding the message here by using Mergify's API. | ||
# | ||
# --- Commit Message and squash Method | ||
# https://doc.mergify.io/actions.html#commit-message-and-squash-method | ||
labels: no changelog | ||
branch: create-pull-request/pkg-update | ||
base: master | ||
- name: Check output environment variable | ||
run: echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}" |