|
1 | | -##!/bin/sh |
2 | | -# |
3 | | -#echo ${GITHUB_TOKEN} | gh auth login --with-token |
4 | | -#export TARGET_BRANCH=$(gh api graphql -f repositoryOwner="${CF_REPO_OWNER}" -f repositoryName="${CF_REPO_NAME}" -f branchName="${CF_BRANCH}" -f query=' |
5 | | -# query getTargetBranch($repositoryOwner: String!, $repositoryName: String!, $branchName: String!) { |
6 | | -# organization(login: $repositoryOwner) { |
7 | | -# repository(name: $repositoryName) { |
8 | | -# defaultBranchRef { |
9 | | -# name |
10 | | -# } |
11 | | -# pullRequests(first: 1, headRefName: $branchName) { |
12 | | -# edges { |
13 | | -# node { |
14 | | -# baseRefName |
15 | | -# } |
16 | | -# } |
17 | | -# } |
18 | | -# } |
19 | | -# } |
20 | | -# } |
21 | | -#' | jq -r '.data.organization.repository | .pullRequests.edges[0].node.baseRefName // .defaultBranchRef.name') |
22 | | -#echo "Target Branch: ${TARGET_BRANCH}" |
23 | | -#export TARGET_VERSION=$(git show origin/${TARGET_BRANCH}:service.yaml | yq -r ".version" -) |
24 | | -#echo "Target Version: ${TARGET_VERSION}" |
25 | | -#export PACKAGE_VERSION=$(if [ -f VERSION ]; then cat VERSION; else yq -r ".version" service.yaml; fi;) |
26 | | -#echo "Package Version: ${PACKAGE_VERSION}" |
27 | | -#semver-cli greater ${PACKAGE_VERSION} ${TARGET_VERSION} |
28 | | -# |
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +echo ${GITHUB_TOKEN} | gh auth login --with-token |
| 4 | +export TARGET_BRANCH=$(gh api graphql -f repositoryOwner="${CF_REPO_OWNER}" -f repositoryName="${CF_REPO_NAME}" -f branchName="${CF_BRANCH}" -f query=' |
| 5 | + query getTargetBranch($repositoryOwner: String!, $repositoryName: String!, $branchName: String!) { |
| 6 | + organization(login: $repositoryOwner) { |
| 7 | + repository(name: $repositoryName) { |
| 8 | + defaultBranchRef { |
| 9 | + name |
| 10 | + } |
| 11 | + pullRequests(first: 1, headRefName: $branchName) { |
| 12 | + edges { |
| 13 | + node { |
| 14 | + baseRefName |
| 15 | + } |
| 16 | + } |
| 17 | + } |
| 18 | + } |
| 19 | + } |
| 20 | + } |
| 21 | +' | jq -r '.data.organization.repository | .pullRequests.edges[0].node.baseRefName // .defaultBranchRef.name') |
| 22 | +echo "Target Branch: ${TARGET_BRANCH}" |
| 23 | +export TARGET_VERSION=$(git show origin/${TARGET_BRANCH}:service.yaml | yq -r ".version" -) |
| 24 | +echo "Target Version: ${TARGET_VERSION}" |
| 25 | +export PACKAGE_VERSION=$(if [ -f VERSION ]; then cat VERSION; else yq -r ".version" service.yaml; fi;) |
| 26 | +echo "Package Version: ${PACKAGE_VERSION}" |
| 27 | +semver-cli greater ${PACKAGE_VERSION} ${TARGET_VERSION} |
| 28 | + |
0 commit comments