File tree 3 files changed +57
-52
lines changed
3 files changed +57
-52
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ module . exports = async ( { github, context} ) => {
2
+ const prBody = context . payload . body ;
3
+ const prNumber = context . payload . number ;
4
+ const releaseLabel = process . env . RELEASE_LABEL ;
5
+ const maintainersTeam = process . env . MAINTAINERS_TEAM
6
+
7
+ const RELATED_ISSUE_REGEX = / I s s u e n u m b e r : .+ ( \d ) /
8
+
9
+ const matcher = new RegExp ( RELATED_ISSUE_REGEX )
10
+ const isMatch = matcher . exec ( prBody )
11
+ if ( isMatch != null ) {
12
+ let relatedIssueNumber = isMatch [ 1 ]
13
+ console . info ( `Auto-labeling related issue ${ relatedIssueNumber } for release` )
14
+
15
+ return await github . rest . issues . addLabels ( {
16
+ issue_number : relatedIssueNumber ,
17
+ owner : context . repo . owner ,
18
+ repo : context . repo . repo ,
19
+ labels : [ releaseLabel ]
20
+ } )
21
+ } else {
22
+ let msg = `${ maintainersTeam } No related issues found. Please ensure '${ releaseLabel } ' label is applied before releasing.` ;
23
+ return await github . rest . issues . createComment ( {
24
+ owner : context . repo . owner ,
25
+ repo : context . repo . repo ,
26
+ body : msg ,
27
+ issue_number : prNumber ,
28
+ } ) ;
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ # Maintenance: Verify why we're having permissions issues even with write scope, then re-enable it.
2
+ # logs: https://github.com/awslabs/aws-lambda-powertools-python/runs/7030238348?check_suite_focus=true
3
+
4
+ on :
5
+ pull_request :
6
+ types :
7
+ - closed
8
+
9
+ env :
10
+ RELEASE_LABEL : " pending-release"
11
+ MAINTAINERS_TEAM : " @awslabs/aws-lambda-powertools-python"
12
+
13
+ jobs :
14
+ release_label_on_merge :
15
+ if : github.event.pull_request.merged == true && github.event.pull_request.user.login != 'dependabot[bot]'
16
+ runs-on : ubuntu-latest
17
+ permissions :
18
+ issues : write # required for new scoped token
19
+ pull-requests : write # required for new scoped token
20
+ steps :
21
+ - name : " Label PR related issue for release"
22
+ uses : actions/github-script@v6
23
+ with :
24
+ github-token : ${{ secrets.GITHUB_TOKEN }}
25
+ script : |
26
+ const script = require('.github/scripts/label_related_issue.js')
27
+ await script({github, context, core})
You can’t perform that action at this time.
0 commit comments