File tree Expand file tree Collapse file tree 3 files changed +31
-19
lines changed Expand file tree Collapse file tree 3 files changed +31
-19
lines changed Original file line number Diff line number Diff line change
1
+ name : ' Get Jira ID'
2
+ outputs :
3
+ jira-id :
4
+ value : ${{ steps.get-id.outputs.jira-id }}
5
+
6
+ runs :
7
+ using : " composite" # <-- this allows these steps to be used by other workflows.
8
+ steps :
9
+ - name : " Get ID or fail"
10
+ id : get-id
11
+ uses : actions/github-script@v7
12
+ with :
13
+ script : |
14
+ const title = context.payload.pull_request.title;
15
+ const regex = /[A-Z][A-Z]+-\d+/;
16
+ const match = title.match(regex)
17
+
18
+ if (!match) {
19
+ core.setFailed("PR title must contain a Jira tag");
20
+ } else {
21
+ console.log("Set output " + match[0]);
22
+ core.setOutput("jira-id", match[0]);
23
+ }
Original file line number Diff line number Diff line change 11
11
if : github.event.pull_request.merged == true
12
12
runs-on : ubuntu-latest
13
13
steps :
14
- - name : Fetch Jira ID from the commit message
15
- id : fetch-jira-id
16
- run : |
17
- JIRA_ID=$(echo '${{ github.event.pull_request.title }}' | grep -Eo '[A-Z][A-Z]+-[0-9]+' | xargs echo -n | tr '[:space:]' ',')
18
- [[ -z "$JIRA_ID" ]] && { echo "No Jira ID found in $1" ; exit 1; }
19
- echo "JIRA_ID=$JIRA_ID" >> $GITHUB_OUTPUT
14
+ - id : get-jira-id
15
+ uses : ./.github/library/get_jira_id
20
16
- name : Clone Cromwell
21
17
uses : actions/checkout@v2
22
18
with :
88
84
git diff
89
85
git config --global user.name "broadbot"
90
86
git config --global user.email "broadbot@broadinstitute.org"
91
- git commit -am "${{ steps.fetch -jira-id.outputs.JIRA_ID }}: Auto update to Cromwell $CROMWELL_VERSION"
87
+ git commit -am "${{ steps.get -jira-id.outputs.jira-id }}: Auto update to Cromwell $CROMWELL_VERSION"
92
88
git push https://broadbot:$BROADBOT_GITHUB_TOKEN@github.com/broadinstitute/cromwhelm.git main
93
89
cd -
94
90
@@ -120,7 +116,7 @@ jobs:
120
116
GH_TOKEN : ${{ secrets.BROADBOT_GITHUB_TOKEN }}
121
117
run : |
122
118
set -e
123
- JIRA_ID=${{ steps.fetch -jira-id.outputs.JIRA_ID }}
119
+ JIRA_ID=${{ steps.get -jira-id.outputs.jira-id }}
124
120
if [[ $JIRA_ID == "missing" ]]; then
125
121
echo "JIRA_ID missing, PR to terra-helmfile will not be created"
126
122
exit 0;
Original file line number Diff line number Diff line change 10
10
validate_pr_name :
11
11
runs-on : ubuntu-latest
12
12
steps :
13
- - name : Validate PR title
14
- id : validate
15
- uses : actions/github-script@v3
16
- with :
17
- github-token : ${{ secrets.GITHUB_TOKEN }}
18
- script : |
19
- const title = context.payload.pull_request.title;
20
- const regex = /[A-Z][A-Z]+-\d+/;
21
- if (!regex.test(title)) {
22
- core.setFailed("PR title must contain a Jira tag");
23
- }
13
+ - uses : actions/checkout@v4
14
+ - id : get-jira-id
15
+ uses : ./.github/library/get_jira_id
16
+ - run : echo Jira ID is ${{ steps.get-jira-id.outputs.jira-id }}
You can’t perform that action at this time.
0 commit comments