Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
name: Check permissions
on:
pull_request:
paths:
- '**/dependencies.gradle'
jobs:
build-develop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: Build develop APK
run: ./gradlew app:assembleDebug
- name: Get permissions
run: $ANDROID_HOME/build-tools/29.0.3/aapt d permissions app/build/outputs/apk/debug/app-debug.apk > permissions-develop.txt
- name: Upload permissions file develop
uses: actions/upload-artifact@v1
with:
name: permissions
path: permissions-develop.txt
build-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build APK from current branch
run: ./gradlew app:assembleDebug
- name: Get permissions
run: $ANDROID_HOME/build-tools/29.0.3/aapt d permissions app/build/outputs/apk/debug/app-debug.apk > permissions-branch.txt
- name: Upload APK
uses: actions/upload-artifact@v1
with:
name: permissions
path: permissions-branch.txt
diff-permissions:
needs: [build-develop, build-branch]
runs-on: ubuntu-latest
steps:
- name: Download permissions
uses: actions/download-artifact@v1
with:
name: permissions
- name: Execute diff
run: diff --changed-group-format='%<%>' --unchanged-group-format='' $GITHUB_WORKSPACE/permissions/permissions-develop.txt $GITHUB_WORKSPACE/permissions/permissions-branch.txt > permissions-diff.txt && echo ::set-env name=NEW_PERMISSIONS::'false' || echo ::set-env name=NEW_PERMISSIONS::'true'
- run: printf "⚠ New permission(s) found\n\n\`\`\`\n" > pr-comment.txt && cat permissions-diff.txt >> pr-comment.txt
- name: comment PR
if: env.NEW_PERMISSIONS == 'true'
uses: machine-learning-apps/pr-comment@master
env:
GITHUB_TOKEN: ${{ secrets.personaltoken }}
with:
path: pr-comment.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment