Skip to content
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

fix: switch from pull_request_target to pull_request #85

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Dependabot Automerge"

on:
workflow_run:
workflows: ["Build and Test"]
types:
- completed

jobs:
automerge-dependabot:
name: "Automerge Dependabot PR"
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
github.actor == 'dependabot[bot]' }}
env:
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-automation
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: [email protected]
runs-on: ubuntu-latest
steps:
- name: 'Download artifact'
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip
- name: 'Automerge PR'
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./NR'));
await github.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: issue_number,
merge_method: 'rebase'
});
18 changes: 9 additions & 9 deletions .github/workflows/pull-request-app-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
uses: actions/checkout@v2
with:
submodules: recursive
# - name: "Create Path Triggers"
# uses: dorny/paths-filter@v2
# id: changes
# with:
# base: main
# ref: ${{ github.head_ref }}
# filters: |
# sample-app:
# - '${{ inputs.app_relative_path }}/**'
# - name: "Create Path Triggers"
# uses: dorny/paths-filter@v2
# id: changes
# with:
# base: main
# ref: ${{ github.head_ref }}
# filters: |
# sample-app:
# - '${{ inputs.app_relative_path }}/**'
# - name: "Cancel workflow"
# if: steps.changes.outputs.sample-app != 'true'
# uses: andymckay/[email protected]
Expand Down
42 changes: 17 additions & 25 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
name: "Pull Request Checks"
name: "Build and Test"

on: [ pull_request_target ]
on: [ push, workflow_dispatch, pull_request ]

jobs:

higgs-shop-sample-app:
name: "Check Higgs Shop Sample App"
uses: mParticle/mparticle-workflows/.github/workflows/android-sample-app-pull-request.yml@stable
uses: mParticle/mparticle-android-sample-apps/.github/workflows/pull-request-app-checks.yml@main
with:
app_relative_path: "core-sdk-samples/higgs-shop-sample-app"

automerge-dependabot:
name: "Automerge Dependabot PR"
name: "Save PR Number for Dependabot Automerge"
needs: [ higgs-shop-sample-app ]
if: ${{ github.actor == 'dependabot[bot]' }}
env:
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: mparticle-bot
GIT_COMMITTER_EMAIL: [email protected]
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: "Rebase Dependabot PR"
uses: actions/github-script@v3
- name: "Checkout PR branch"
uses: actions/checkout@v2
with:
script: |
github.pulls.merge({
owner: context.repo.owner,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number,
merge_method: 'rebase'
});
rebase-development:
name: "Rebase Development onto Dependabot Branch"
needs: [ automerge-dependabot ]
if: ${{ github.actor == 'dependabot[bot]' }}
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-rebase-development.yml@stable
submodules: recursive
fetch-depth: 0
- name: "Save Pull Request Number"
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@v2
with:
name: pr
path: pr/
11 changes: 0 additions & 11 deletions .github/workflows/push.yml

This file was deleted.

2 changes: 1 addition & 1 deletion core-sdk-samples/higgs-shop-sample-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.2")
classpath("com.android.tools.build:gradle:7.2.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
}
}
Expand Down