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

ci: remove "Log PR Number" step #172

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Changes from 2 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
185 changes: 90 additions & 95 deletions .github/workflows/auto_assign_pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Auto Assign PR'
name: "Auto Assign PR"

on:
workflow_call:
Expand All @@ -9,98 +9,93 @@ on:
- completed

jobs:

add-reviewers:
name: "Add reviewers to PR"
add-reviewers:
name: "Add reviewers to PR"
if: >
github.event.workflow_run.event == 'pull_request' &&
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: "Print Event"
run: |
echo ${{ github.event.workflow_run.event }}
- 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: "Find PR Number"
id: find-pr-number
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var str = String(fs.readFileSync('./NR'));
var array = str.split(',')
return array[0]
result-encoding: string
- name: "Find PR Title"
id: find-pr-title
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var str = String(fs.readFileSync('./NR'));
var array = str.split(',')
return array[1]
result-encoding: string
- name: "Log PR Title"
run: |
echo "${{ steps.find-pr-title.outputs.result }}"
- name: "Check PR title"
id: is-docs
if: >
github.event.workflow_run.event == 'pull_request' &&
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: 'Print Event'
run: |
echo ${{ github.event.workflow_run.event }}
- 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: 'Find PR Number'
id: find-pr-number
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var str = String(fs.readFileSync('./NR'));
var array = str.split(',')
return array[0]
result-encoding: string
- name: 'Find PR Title'
id: find-pr-title
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var str = String(fs.readFileSync('./NR'));
var array = str.split(',')
return array[1]
result-encoding: string
- name: "Log PR Number"
run: |
echo "${{ steps.find-pr-number.outputs.result }}"
- name: "Log PR Title"
run: |
echo "${{ steps.find-pr-title.outputs.result }}"
- name: "Check PR title"
id: is-docs
if: >
startsWith(steps.find-pr-title.outputs.result, 'docs:')
run: |
OUTPUT=true
echo "::set-output name=isDocs::$OUTPUT"
- name: "echo isDocs"
run: |
echo ${{ steps.is-docs.outputs.isDocs }}
- name: "PR title is docs"
if: ${{steps.is-docs.outputs.isDocs == 'true'}}
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{secrets.MP_SEMANTIC_RELEASE_BOT}}" \
https://api.github.com/repos/mParticle/mparticle-android-sample-apps/pulls/${{ steps.find-pr-number.outputs.result }}/requested_reviewers \
-d '{"reviewers":["schallock","MystiBerry"],"team_reviewers":["docs-triage"]}'
- name: "PR title is not docs"
if: ${{ steps.is-docs.outputs.isDocs != 'true'}}
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{secrets.MP_SEMANTIC_RELEASE_BOT}}" \
https://api.github.com/repos/mParticle/mparticle-android-sample-apps/pulls/${{ steps.find-pr-number.outputs.result }}/requested_reviewers \
-d '{"reviewers":["mchuangatmp"],"team_reviewers":["android-triage"]}'

startsWith(steps.find-pr-title.outputs.result, 'docs:')
run: |
OUTPUT=true
echo "::set-output name=isDocs::$OUTPUT"
- name: "echo isDocs"
run: |
echo ${{ steps.is-docs.outputs.isDocs }}
- name: "PR title is docs"
if: ${{steps.is-docs.outputs.isDocs == 'true'}}
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{secrets.MP_SEMANTIC_RELEASE_BOT}}" \
https://api.github.com/repos/mParticle/mparticle-android-sample-apps/pulls/${{ steps.find-pr-number.outputs.result }}/requested_reviewers \
-d '{"reviewers":["schallock","MystiBerry"],"team_reviewers":["docs-triage"]}'
- name: "PR title is not docs"
if: ${{ steps.is-docs.outputs.isDocs != 'true'}}
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{secrets.MP_SEMANTIC_RELEASE_BOT}}" \
https://api.github.com/repos/mParticle/mparticle-android-sample-apps/pulls/${{ steps.find-pr-number.outputs.result }}/requested_reviewers \
-d '{"reviewers":["mchuangatmp"],"team_reviewers":["android-triage"]}'