Skip to content

Commit

Permalink
Merge pull request #57234 from software-mansion-labs/jnowakow/separat…
Browse files Browse the repository at this point in the history
…e-build-started-comment-workflow

[No QA] Move postGitHubCommentBuildStarted to separate file
  • Loading branch information
justinpersaud authored Feb 25, 2025
2 parents e12e4b3 + 43bfcbe commit 8dba3d9
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 73 deletions.
37 changes: 7 additions & 30 deletions .github/workflows/compareNDandODbuilds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,13 @@ jobs:


postGitHubCommentBuildStarted:
runs-on: ubuntu-latest
needs: [getBranchRef, getOldDotBranchRef]
steps:
- name: Add comment to ND PR
if: ${{ github.event.inputs.PULL_REQUEST_NUMBER != ''}}
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.inputs.PULL_REQUEST_NUMBER }},
body: `🚧 @${{ github.actor }} has triggered build profiling. You can view the [workflow run here](${workflowURL}).`
});
- name: Add comment to OD PR
if: ${{ github.event.inputs.OLD_DOT_PULL_REQUEST_NUMBER != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.OS_BOTIFY_TOKEN }}
script: |
const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: 'Mobile-Expensify',
issue_number: ${{ github.event.inputs.OLD_DOT_PULL_REQUEST_NUMBER }},
body: `🚧 @${{ github.actor }} has triggered build profiling. You can view the [workflow run here](${workflowURL}).`
});
name: Post build started comment
uses: ./.github/workflows/postBuildStartedComment.yml
secrets: inherit
with:
APP_PULL_REQUEST_NUMBER: ${{ inputs.PULL_REQUEST_NUMBER }}
HYBRIDAPP_PULL_REQUEST_NUMBER: ${{ inputs.OLD_DOT_PULL_REQUEST_NUMBER }}


buildHybridAppAndroid:
name: Build HybridApp Android
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/postBuildStartedComment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Post build has been started comment

on:
workflow_call:
inputs:
APP_PULL_REQUEST_NUMBER:
description: Number of the Pull Request in the App repository where the comment will be posted
type: string
required: false
HYBRIDAPP_PULL_REQUEST_NUMBER:
description: Number of the Pull Request in the Mobile-Expensify repository where the comment will be posted
type: string
required: false

jobs:
postGitHubCommentBuildStarted:
runs-on: ubuntu-latest
steps:
- name: Add build start comment to ND PR
if: ${{ inputs.APP_PULL_REQUEST_NUMBER != ''}}
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ inputs.APP_PULL_REQUEST_NUMBER }},
body: `🚧 @${{ github.actor }} has triggered a test hybrid app build. You can view the [workflow run here](${workflowURL}).`
});
- name: Add build start comment to OD PR
if: ${{ inputs.HYBRIDAPP_PULL_REQUEST_NUMBER != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.OS_BOTIFY_TOKEN }}
script: |
const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: 'Mobile-Expensify',
issue_number: ${{ inputs.HYBRIDAPP_PULL_REQUEST_NUMBER }},
body: `🚧 @${{ github.actor }} has triggered a test hybrid app build. You can view the [workflow run here](${workflowURL}).`
});
19 changes: 5 additions & 14 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,12 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}

postGitHubCommentBuildStarted:
runs-on: ubuntu-latest
name: Post build started comment
uses: ./.github/workflows/postBuildStartedComment.yml
needs: [prep]
steps:
- name: Add build start comment
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: process.env.PULL_REQUEST_NUMBER,
body: `🚧 @${{ github.actor }} has triggered a test build. You can view the [workflow run here](${workflowURL}).`
});
secrets: inherit
with:
APP_PULL_REQUEST_NUMBER: ${{ github.event.number || github.event.inputs.PULL_REQUEST_NUMBER }}

buildAndroid:
name: Build Android app for testing
Expand Down
35 changes: 6 additions & 29 deletions .github/workflows/testBuildHybrid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,36 +110,13 @@ jobs:


postGitHubCommentBuildStarted:
runs-on: ubuntu-latest
name: Post build started comment
uses: ./.github/workflows/postBuildStartedComment.yml
needs: [getNewDotRef, getOldDotPR, getOldDotRef]
steps:
- name: Add build start comment to ND PR
if: ${{ github.event.inputs.APP_PULL_REQUEST_NUMBER != ''}}
uses: actions/github-script@v7
with:
github-token: ${{ github.token }}
script: |
const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.inputs.APP_PULL_REQUEST_NUMBER }},
body: `🚧 @${{ github.actor }} has triggered a test hybrid app build. You can view the [workflow run here](${workflowURL}).`
});
- name: Add build start comment to OD PR
if: ${{ needs.getOldDotPR.outputs.OLD_DOT_PR != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.OS_BOTIFY_TOKEN }}
script: |
const workflowURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: 'Mobile-Expensify',
issue_number: ${{ needs.getOldDotPR.outputs.OLD_DOT_PR }},
body: `🚧 @${{ github.actor }} has triggered a test hybrid app build. You can view the [workflow run here](${workflowURL}).`
});
secrets: inherit
with:
APP_PULL_REQUEST_NUMBER: ${{ inputs.APP_PULL_REQUEST_NUMBER }}
HYBRIDAPP_PULL_REQUEST_NUMBER: ${{ github.event.inputs.HYBRIDAPP_PULL_REQUEST_NUMBER || needs.getOldDotPR.outputs.OLD_DOT_PR }}

androidHybrid:
name: Build Android HybridApp
Expand Down

0 comments on commit 8dba3d9

Please sign in to comment.