-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: switch from pull_request_target to pull_request (#85)
- Loading branch information
1 parent
7e4239f
commit a982c4f
Showing
5 changed files
with
84 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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,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' | ||
}); |
This file contains 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 |
---|---|---|
|
@@ -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] | ||
|
This file contains 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 |
---|---|---|
@@ -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/ |
This file was deleted.
Oops, something went wrong.
This file contains 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