File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ module . exports = async ( { github, context, core} ) => {
2+ const fs = require ( 'fs' ) ;
3+ const filename = "pr.txt" ;
4+
5+ try {
6+ core . debug ( "Payload as it comes.." ) ;
7+ core . debug ( context . payload ) ;
8+ fs . writeFileSync ( `./${ filename } ` , JSON . stringify ( context . payload ) ) ;
9+
10+ return `PR successfully saved ${ filename } `
11+ } catch ( err ) {
12+ core . setFailed ( "Failed to save PR details" ) ;
13+ console . error ( err ) ;
14+ }
15+ }
Original file line number Diff line number Diff line change @@ -2,23 +2,21 @@ name: Record PR number
22
33on :
44 pull_request :
5- types : [opened, edited]
5+ types : [opened, edited, closed ]
66
77jobs :
88 build :
99 runs-on : ubuntu-latest
1010
1111 steps :
1212 - uses : actions/checkout@v3
13- - name : Save PR number
14- run : |
15- mkdir -p ./pr
16- echo ${{ github.event.number }} > ./pr/number
17- echo "${{ github.event.pull_request.title }}" > ./pr/title
18- echo "${{ github.event.pull_request.body }}" > ./pr/body
19- echo "${{ github.event.pull_request.user.login }}" > ./pr/author
20- echo "${{ github.event.action }}" > ./pr/action
13+ - name : " Extract PR details"
14+ uses : actions/github-script@v6
15+ with :
16+ script : |
17+ const script = require('.github/scripts/save_pr_details.js')
18+ await script({github, context, core})
2119 - uses : actions/upload-artifact@v3
2220 with :
2321 name : pr
24- path : pr/
22+ path : pr.txt
You can’t perform that action at this time.
0 commit comments