Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
47 changes: 47 additions & 0 deletions .github/workflows/release-vscode-ext.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release VS Code Extension

on:
issue_comment:
types: [created]

permissions:
Comment thread
morganchen12 marked this conversation as resolved.
contents: write
Comment thread
hlshen marked this conversation as resolved.
pull-requests: read
issues: read

jobs:
release:
if: |
github.event.issue.pull_request &&
Comment thread
joehan marked this conversation as resolved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add an author check here.

(github.event.issue.author_association == 'OWNER' ||
github.event.issue.author_association == 'MEMBER')

startsWith(github.event.comment.body, '/run-release') &&
(github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets also assert that the pr aiuthor is an owner or maintainer as well. I don't think we'd ever run this on a contributor branch, but we should encode that into the rule

runs-on: ubuntu-latest
steps:
- name: Trigger Kokoro via API
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
PR_NUM="${{ github.event.issue.number }}"
Comment thread
morganchen12 marked this conversation as resolved.
echo "Fetching SHA for PR $PR_NUM..."
SHA=$(gh pr view "$PR_NUM" --json headRefOid -q .headRefOid)
echo "PR Head SHA is $SHA"

if [[ "$COMMENT_BODY" == *"--build-only"* ]]; then
TARGET_BRANCH="vscode-release-trigger-build-only"
else
TARGET_BRANCH="vscode-release-trigger"
Comment on lines +32 to +34

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given these are going to be origins for release artifacts, you should work with Joe to set up branch protections for these branches.

fi
echo "Target branch is $TARGET_BRANCH"

# Try to update the branch ref (force-push equivalent via API)
if gh api -X PATCH "/repos/${{ github.repository }}/git/refs/heads/$TARGET_BRANCH" \
-f sha="$SHA" -f force=true >/dev/null 2>&1; then
echo "Successfully updated ref refs/heads/$TARGET_BRANCH to $SHA"
else
echo "Ref refs/heads/$TARGET_BRANCH not found. Creating it..."
gh api -X POST "/repos/${{ github.repository }}/git/refs" \
-f ref="refs/heads/$TARGET_BRANCH" -f sha="$SHA" >/dev/null
echo "Successfully created ref refs/heads/$TARGET_BRANCH at $SHA"
fi
2 changes: 2 additions & 0 deletions firebase-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## NEXT

## 2.4.1

- Update internal `firebase-tools` dependency to 15.21.0
Expand Down
Loading