-
Notifications
You must be signed in to change notification settings - Fork 1
Enable mt-sync-code-data workflow on PRs with automatic skip of data download and app release
#539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2575620
Initial plan
Copilot be53286
Add pull request trigger to mt-sync-code-data workflow with automatic…
Copilot 293b8f9
Merge branch 'master' into copilot/update-mt-sync-workflow
mmathieum d5fc0f7
finishing
mmathieum 2e9a336
PR comments
mmathieum a32a9c1
wip
mmathieum af7ff8f
fix
mmathieum File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| # ORIGINAL FILE: https://github.com/mtransitapps/commons/tree/master/shared-overwrite | ||
| name: MT setup | ||
| description: 'Setup workspace (git submodules/branches & gradle)' | ||
| inputs: | ||
| code-sync: | ||
| description: "Sync code from submodules before setup." | ||
| type: boolean | ||
| default: false | ||
| required: false | ||
| # TODO outputs? | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
|
|
||
| - name: MT set environement variables | ||
| shell: bash | ||
| run: | | ||
| MT_IS_SUBMODULE=${{ contains(fromJSON('["mtransitapps/commons", "mtransitapps/commons-java", "mtransitapps/parser", "mtransitapps/commons-android"]'), github.repository) }} | ||
| echo "[MT] > set MT_IS_SUBMODULE='$MT_IS_SUBMODULE'." | ||
| echo "MT_IS_SUBMODULE=$MT_IS_SUBMODULE" >> $GITHUB_ENV | ||
| # | ||
| echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY."; | ||
| if [[ "$GITHUB_REPOSITORY" =~ ^mtransitapps/[a-zA-Z]{2}-.* ]]; then | ||
| MT_IS_AGENCY_REPO=true; | ||
| else | ||
| MT_IS_AGENCY_REPO=false; | ||
| fi | ||
| echo "[MT] > set MT_IS_AGENCY_REPO='$MT_IS_AGENCY_REPO'." | ||
| echo "MT_IS_AGENCY_REPO=$MT_IS_AGENCY_REPO" >> $GITHUB_ENV | ||
|
|
||
| - name: MT check out submodules | ||
| shell: bash | ||
| run: ./checkout_submodules.sh | ||
| - name: MT check out all git submodule closest branch | ||
| if: github.event_name == 'pull_request' | ||
| shell: bash | ||
| run: | | ||
| echo "[MT] > Checking out submodules closest branch, '$MT_BRANCH_NAME' or '$MT_TARGET_BRANCH_NAME':" | ||
| git submodule foreach 'git checkout $MT_BRANCH_NAME || git checkout $MT_TARGET_BRANCH_NAME' | ||
| echo "[MT] > Showing submodules current branch:" | ||
| git submodule foreach 'git branch --show-current' | ||
|
|
||
| - name: MT checkout this repo PR branch to allow push commits | ||
| if: github.event_name == 'pull_request' && env.MT_IS_AGENCY_REPO == 'true' | ||
| shell: bash | ||
| run: | | ||
| echo "[MT] > Checking out this repo closest branch, '$MT_BRANCH_NAME' or '$MT_TARGET_BRANCH_NAME':" | ||
| git checkout $MT_BRANCH_NAME || git checkout $MT_TARGET_BRANCH_NAME | ||
| echo "[MT] > Showing this repo current branch:" | ||
| git branch --show-current | ||
|
|
||
| - name: MT check out this submodule repo build SHA | ||
| if: env.MT_IS_SUBMODULE == 'true' | ||
| shell: bash | ||
| run: | | ||
| REPOSITORY_OWNER_AND_NAME=${{ github.repository }}; | ||
| REPOSITORY_NAME=$(basename $REPOSITORY_OWNER_AND_NAME); | ||
| echo "[MT] > Checking out this repo '$REPOSITORY_NAME' workflow sha '$MT_SHA':" | ||
| git -C $REPOSITORY_NAME checkout $MT_SHA; | ||
|
|
||
| - name: MT setup MT_GIT_BRANCH env | ||
| if: github.repository == 'mtransitapps/mtransit-for-android' || github.event_name != 'pull_request' | ||
| shell: bash | ||
| run: | | ||
| # MT_GIT_BRANCH=${GITHUB_REF##*/}" | ||
| MT_GIT_BRANCH=${{ github.head_ref || github.ref_name }} | ||
| echo "[MT] > setup MT_GIT_BRANCH='$MT_GIT_BRANCH'." | ||
| # echo "MT_GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
| echo "MT_GIT_BRANCH=$MT_GIT_BRANCH" >> $GITHUB_ENV | ||
|
|
||
| - name: MT code sync | ||
| shell: bash | ||
| if: ${{ inputs.code-sync == 'true' }} | ||
| run: ./commons/code_sync.sh | ||
|
|
||
| - name: MT code setup | ||
| shell: bash | ||
| run: ./commons/code_setup.sh | ||
| - name: MT set up JDK 17 | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.