Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(packages/sui-test-contract): use GITHUB_HEAD_REF and GITHUB_REF_NAME and add Tags info on console logging #1694

Merged
merged 6 commits into from
Jan 15, 2024
25 changes: 20 additions & 5 deletions packages/sui-test-contract/bin/sui-test-contract-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,24 @@ program
const {brokerUrl} = program.opts()
if (!brokerUrl) throw new Error('You need to specify the broker URL where the contracts will be published.')
const contractsDir = path.resolve(process.cwd(), 'contract/documents')
const {GITHUB_REF, GITHUB_SHA, TRAVIS_PULL_REQUEST_BRANCH, TRAVIS_BRANCH, TRAVIS_COMMIT, TRAVIS_PULL_REQUEST_SHA} =
process.env

const branch = TRAVIS_PULL_REQUEST_BRANCH || TRAVIS_BRANCH || GITHUB_REF || exec('git rev-parse --abbrev-ref HEAD')
const {
GITHUB_HEAD_REF,
GITHUB_REF,
GITHUB_REF_NAME,
GITHUB_SHA,
TRAVIS_PULL_REQUEST_BRANCH,
TRAVIS_BRANCH,
TRAVIS_COMMIT,
TRAVIS_PULL_REQUEST_SHA
} = process.env

const branch =
TRAVIS_PULL_REQUEST_BRANCH ||
TRAVIS_BRANCH ||
GITHUB_HEAD_REF ||
GITHUB_REF_NAME ||
GITHUB_REF ||
exec('git rev-parse --abbrev-ref HEAD')
const consumerVersion = TRAVIS_PULL_REQUEST_SHA || TRAVIS_COMMIT || GITHUB_SHA

const options = {
Expand All @@ -35,7 +49,8 @@ new Publisher(options)
.publishPacts()
.then(() => {
console.log(`Pact contract for consumer version ${options.consumerVersion} published!`)
console.log(`Head over to ${brokerUrl} and login with to see your published contracts.`)
console.log(`Head over to ${brokerUrl} and login to see your published contracts.`)
console.log(`Tags: ${branch}`)
})
.catch(error => {
throw new Error(`Pact contract publishing failed: ${error}`)
Expand Down
Loading