Skip to content

Commit 94bba48

Browse files
authored
Merge pull request #1 from pirafrank/main
fixes
2 parents 512f3d9 + 015ebf7 commit 94bba48

File tree

4 files changed

+52
-14
lines changed

4 files changed

+52
-14
lines changed

.github/workflows/pr.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Pull Request
2+
3+
on:
4+
# Note that GITHUB_SHA for this event is the last merge commit of the pull
5+
# request merge branch. If you want to get the commit ID for the last commit
6+
# to the head branch of the pull request,
7+
# use github.event.pull_request.head.sha instead.
8+
# Docs: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
9+
pull_request:
10+
types: [opened, synchronize, reopened]
11+
branches:
12+
- 'v*'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
- name: Clone repo
20+
uses: actions/checkout@v4
21+
22+
- name: Set .nvmrc content to stage output
23+
id: nvmrc
24+
run: |
25+
echo "node_version=$(cat .nvmrc | sed 's/v//g')" >> $GITHUB_OUTPUT
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v2
29+
with:
30+
node-version: ${{ steps.nvmrc.outputs.nvmrc }}
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Run tests
36+
run: npm run test
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GH_TKN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
.env
3+
.env.sh
34
*.json
45

entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env bash
22

33
set -e
4-
node /app/github.js $@
4+
argv=(node /app/github.js "$@")
5+
cmd=$(printf '%q ' "${argv[@]}")
6+
eval $cmd

index.test.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,16 @@ describe("createCommitOnBranch", () => {
2727
"the description of the commit"
2828
);
2929
console.log(JSON.stringify(result, null, 2));
30-
expect(result).toMatchObject({
31-
data: {
32-
createCommitOnBranch: {
33-
commit: {
34-
url: expect.stringMatching(
35-
new RegExp(
36-
"^https:\/\/github\.com\/"+repoOwner+"\/"+repoName+"\/commit\/[a-fA-F0-9]{40}$"
37-
)
38-
),
39-
},
40-
},
41-
},
42-
});
30+
const commitUrl = result?.commitUrl || "";
31+
expect(commitUrl).toMatch(
32+
new RegExp(
33+
"^https://github.com/" +
34+
repoOwner +
35+
"/" +
36+
repoName +
37+
"/commit/[a-fA-F0-9]{40}$"
38+
)
39+
);
4340
});
4441
test("createCommitOnBranch, BAD branch", async () => {
4542
expect(async () => {

0 commit comments

Comments
 (0)