Skip to content

Commit 7fccfb2

Browse files
authored
Merge pull request #3 from pirafrank/dev
minor improvements
2 parents ba5d7c1 + ed64d8f commit 7fccfb2

File tree

5 files changed

+52
-8
lines changed

5 files changed

+52
-8
lines changed

.github/workflows/pr.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
echo "node_version=$(cat .nvmrc | sed 's/v//g')" >> $GITHUB_OUTPUT
2626
2727
- name: Setup Node.js
28-
uses: actions/setup-node@v2
28+
uses: actions/setup-node@v4
2929
with:
30-
node-version: ${{ steps.nvmrc.outputs.nvmrc }}
30+
node-version: ${{ steps.nvmrc.outputs.node_version }}
3131

3232
- name: Install dependencies
3333
run: npm ci
@@ -57,4 +57,3 @@ jobs:
5757
env:
5858
GITHUB_TOKEN: ${{ secrets.GH_TKN }}
5959
run: npm run docker:test
60-
continue-on-error: true

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to npm.js
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-20.04
10+
11+
steps:
12+
- name: Clone repo
13+
uses: actions/checkout@v4
14+
15+
- name: Set .nvmrc content to stage output
16+
id: nvmrc
17+
run: |
18+
echo "node_version=$(cat .nvmrc | sed 's/v//g')" >> $GITHUB_OUTPUT
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ steps.nvmrc.outputs.node_version }}
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Publish to npm
30+
run: npm publish --provenance --access public
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ You can use this module as a GitHub Action. It is a Docker-based action.
114114
```yaml
115115
# Print help
116116
- name: Print graphQL client help
117-
uses: pirafrank/github-graphql-client@v1
117+
uses: pirafrank/github-graphql-client@v0
118118
with:
119119
args: "--help"
120120
```
@@ -132,7 +132,7 @@ To commit to other repositories, you may need to override the default `GITHUB_TO
132132
# Commit changes...
133133
- name: Commit changes
134134
id: commit_changes
135-
uses: pirafrank/github-graphql-client@v1
135+
uses: pirafrank/github-graphql-client@v0
136136
if: ${{ vars.RUN_COMMIT_CHANGES == 'true' }}
137137
env:
138138
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -e
44

5-
if [ -z "$GITHUB_TOKEN" ]; then
5+
# if the first argument is not an option, a command has been issued,
6+
# and we need to check if the GITHUB_TOKEN is set.
7+
if [[ "$1" != -* ]] && [[ -z "$GITHUB_TOKEN" ]]; then
68
echo "GITHUB_TOKEN is not set. Exiting."
79
exit 1
810
fi

test.docker.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
#!/usr/bin/env bash
22

3-
source .env.sh
3+
# following commands should work without the GITHUB_TOKEN needing to be set.
44

55
echo "************** help *****************"
66

77
# test handling of single parameter
88
docker run --rm \
99
-v ./dummy:/app/dummy \
1010
-w /app \
11-
-e GITHUB_TOKEN \
1211
-e DEBUG \
1312
github-graphql-client:latest "--help"
1413

14+
echo "************** version *****************"
15+
16+
# test handling of single parameter
17+
docker run --rm \
18+
-v ./dummy:/app/dummy \
19+
-w /app \
20+
-e DEBUG \
21+
github-graphql-client:latest "-v"
22+
23+
# commands below need GITHUB_TOKEN to be set.
24+
source .env.sh
25+
1526
echo "************ branch arg missing *******************"
1627

1728
# test handling of multiple parameters

0 commit comments

Comments
 (0)