Skip to content

Commit 6767ef4

Browse files
authored
WX-1611 Make deploy process 'compatible" with quotes 🎉 (#7423)
1 parent b59ea9e commit 6767ef4

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}

.github/workflows/chart_update_on_merge.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ jobs:
1111
if: github.event.pull_request.merged == true
1212
runs-on: ubuntu-latest
1313
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
2016
- name: Clone Cromwell
2117
uses: actions/checkout@v2
2218
with:
@@ -88,7 +84,7 @@ jobs:
8884
git diff
8985
git config --global user.name "broadbot"
9086
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"
9288
git push https://broadbot:$BROADBOT_GITHUB_TOKEN@github.com/broadinstitute/cromwhelm.git main
9389
cd -
9490
@@ -120,7 +116,7 @@ jobs:
120116
GH_TOKEN: ${{ secrets.BROADBOT_GITHUB_TOKEN }}
121117
run: |
122118
set -e
123-
JIRA_ID=${{ steps.fetch-jira-id.outputs.JIRA_ID }}
119+
JIRA_ID=${{ steps.get-jira-id.outputs.jira-id }}
124120
if [[ $JIRA_ID == "missing" ]]; then
125121
echo "JIRA_ID missing, PR to terra-helmfile will not be created"
126122
exit 0;

.github/workflows/validate_pr_name.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ jobs:
1010
validate_pr_name:
1111
runs-on: ubuntu-latest
1212
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 }}

0 commit comments

Comments
 (0)