File tree Expand file tree Collapse file tree 4 files changed +52
-14
lines changed
Expand file tree Collapse file tree 4 files changed +52
-14
lines changed Original file line number Diff line number Diff line change 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 }}
Original file line number Diff line number Diff line change 11node_modules
22.env
3+ .env.sh
34* .json
45
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33set -e
4- node /app/github.js $@
4+ argv=(node /app/github.js " $@ " )
5+ cmd=$( printf ' %q ' " ${argv[@]} " )
6+ eval $cmd
Original file line number Diff line number Diff 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 ( ) => {
You can’t perform that action at this time.
0 commit comments