-
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INFRA-2087 auto generated issues for mobile and extension repositories
- Loading branch information
Showing
2 changed files
with
88 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,76 @@ | ||
name: Create Update Issues | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
AUTH_APP_ID: | ||
description: Github app id to authenticate in mobile and extention repositories | ||
type: string | ||
required: true | ||
secrets: | ||
AUTH_APP_PRIVATE_KEY: | ||
description: Github app private key to authenticate in mobile and extention repositories | ||
required: true | ||
|
||
jobs: | ||
create-update-issues: | ||
permissions: | ||
issues: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout head | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get release tag | ||
id: releaseTag | ||
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | ||
|
||
- name: Check released package | ||
id: releaseCheck | ||
env: | ||
tag: ${{ steps.releaseTag.outputs.tag }} | ||
run: | | ||
if [[ ${tag} == @metamask/* ]] ; then | ||
# Extract package name without the leading '@' | ||
package_name="${tag#@}" | ||
package_name="${package_name%@*}" | ||
echo "package_name=${package_name}" >> $GITHUB_OUTPUT | ||
# Extract version number | ||
version="${tag##*@}" | ||
echo "version=${version}" >> $GITHUB_OUTPUT | ||
# Check if version number ends with .0.0 | ||
if [[ $version == *.0.0 ]]; then | ||
echo "$package_name major update" | ||
echo "major_version=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "$package_name minor update" | ||
echo "major_version=false" >> $GITHUB_OUTPUT | ||
fi | ||
else | ||
echo 'Monorepo version update' | ||
echo "major_version=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Generate a token | ||
id: generate-token | ||
if: ${{ steps.releaseCheck.outputs.major_version == 'true' }} | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ inputs.AUTH_APP_ID }} | ||
private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }} | ||
repositories: metamask-mobile, metamask-extension | ||
|
||
- name: Create Issue | ||
if: ${{ steps.releaseCheck.outputs.major_version == 'true' }} | ||
env: | ||
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | ||
package: ${{ steps.releaseCheck.outputs.package_name }} | ||
version: ${{ steps.releaseCheck.outputs.version }} | ||
run: | | ||
echo "Creating new issue..." | ||
gh issue create --title "Update ${package} to version ${version}" --body "Please update ${package} to version ${version}" --repo "MetaMask/metamask-extension" | ||
gh issue create --title "Update ${package} to version ${version}" --body "Please update ${package} to version ${version}" --repo "MetaMask/metamask-mobile" |
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