diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7c3e6eb..a96b9d7 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -18,6 +18,8 @@ jobs: steps: - name: Clone repo uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set .nvmrc content to stage output id: nvmrc @@ -32,6 +34,17 @@ jobs: - name: Install dependencies run: npm ci + - name: Check git tag for version + run: | + PACKAGE_VERSION=$(node -p "require('./package.json').version") + echo "Current version in package.json: $PACKAGE_VERSION" + if git rev-parse "${PACKAGE_VERSION}" >/dev/null 2>&1; then + echo "Error: git tag ${PACKAGE_VERSION} already exists." + exit 1 + else + echo "Good: no matching git tag exists for version ${PACKAGE_VERSION}" + fi + - name: Run tests run: npm run test env: diff --git a/package-lock.json b/package-lock.json index d4a3296..2c09c68 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pirafrank/github-graphql-client", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pirafrank/github-graphql-client", - "version": "0.1.2", + "version": "0.1.3", "license": "MIT", "dependencies": { "graphql": "^16.8.1", diff --git a/package.json b/package.json index 67044fe..848db4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pirafrank/github-graphql-client", - "version": "0.1.2", + "version": "0.1.3", "description": "Simple GitHub client to commit via their graphql APIs", "main": "index.js", "private": false, diff --git a/test.docker.sh b/test.docker.sh index 88b7a66..0ce8416 100755 --- a/test.docker.sh +++ b/test.docker.sh @@ -21,7 +21,15 @@ docker run --rm \ github-graphql-client:latest "-v" # commands below need GITHUB_TOKEN to be set. -source .env.sh +if [[ -f .env.sh ]]; then + echo "Sourcing .env.sh file" + source .env.sh +elif [[ ! -z "$GITHUB_TOKEN" ]]; then + echo "No .env.sh file set, reading GITHUB_TOKEN from environment" +else + echo "GITHUB_TOKEN not set and .env.sh does not exist. Exiting..." + exit 1 +fi echo "************ branch arg missing *******************"