Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions .github/workflows/releasepr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

with:
# Read-only checkout: the default token is never persisted into the git
# config. The write-capable app token is only introduced at the push
# step below.
persist-credentials: false
Comment on lines 13 to +19

- name: Get package info
shell: bash
id: package-info
Expand All @@ -34,18 +39,30 @@ jobs:
return releaseWithTag ? 'true' : 'false'
result-encoding: string

- name: Make changes to pull request
- name: Create release pull request
if: steps.pre-release-exists.outputs.result == 'true'
run: date +%s > auto-release.log
env:
APP_VERSION: ${{ steps.package-info.outputs.version }}
GH_TOKEN: ${{ secrets.JLAB_APP_TOKEN }}
run: |
set -eux
# git checkout -b fails if the branch already exists, which keeps a
# re-run from opening a duplicate release PR.
BRANCH_NAME="release-v${APP_VERSION}"
git checkout -b "${BRANCH_NAME}"
git config user.name "JupyterLab Desktop Bot"
git config user.email 'jupyterlab-bot@users.noreply.github.com'

- name: Create Release pull request
if: steps.pre-release-exists.outputs.result == 'true'
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
with:
token: ${{ secrets.JLAB_APP_TOKEN }}
commit-message: Update auto-release logs
branch: release-v${{ steps.package-info.outputs.version}}
title: 'Release v${{ steps.package-info.outputs.version}}'
body: |
Release v${{ steps.package-info.outputs.version}}
draft: false
date +%s > auto-release.log
git add auto-release.log
git commit -m "Update auto-release logs"
# Checkout ran with persist-credentials: false. Wire the app token in
# through gh's credential helper just for this push, so it never lands
# in the git config or the command log; git push then uses GH_TOKEN.
Comment thread
krassowski marked this conversation as resolved.
gh auth setup-git
git push origin "HEAD:refs/heads/${BRANCH_NAME}"

gh pr create \
--head "${BRANCH_NAME}" \
--title "Release v${APP_VERSION}" \
--body "Release v${APP_VERSION}"
Comment thread
Copilot marked this conversation as resolved.
Loading