Update step-4-quick-filter-for-the-worklist-85ec3a9.md #95
Workflow file for this run
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
name: Merged pull request labeler | |
# What the execution context is: | |
# The merging (not just closing) of a pull request. | |
# What it does: | |
# Assigns the 'valuable contribution' label. | |
# Why we need it: | |
# To mark a valuable pull request contribution, and thus to cause the | |
# SAP Community profile URL requester to be triggered. | |
# What's important to know: | |
# The label to assign is defined at the start of the job, in the LABEL | |
# environment variable. The label is not assigned if the actor is an administrator. | |
on: | |
pull_request_target: | |
types: [closed] | |
jobs: | |
assign-label-on-merge: | |
if: contains(github.repositoryUrl, 'github.com') && github.event.pull_request.merged | |
env: | |
LABEL: "contribution" | |
runs-on: ubuntu-20.04 | |
steps: | |
- id: token_gen | |
name: Generate app installation token | |
uses: machine-learning-apps/actions-app-token@0.21 | |
with: | |
APP_PEM: ${{ secrets.SAP_CODOC_APP_PEM_BASE64 }} | |
APP_ID: ${{ secrets.SAP_CODOC_APP_ID }} | |
- id: checkout | |
name: Check out the repo | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ steps.token_gen.outputs.app_token }} | |
- id: auth_gh | |
name: Authenticate gh to repo | |
run: echo -n ${{ steps.token_gen.outputs.app_token }} | gh auth login --with-token | |
- id: determine_permission | |
name: Look up repository permission level for PR author | |
run: | | |
pr_author="$(gh api --jq .user.login "${{ github.event.pull_request._links.self.href }}")" | |
permission="$(gh api --jq .permission "/repos/$GITHUB_REPOSITORY/collaborators/$pr_author/permission")" | |
echo "pr_author=$pr_author" | |
echo "repo_permission=$permission" | tee --append "$GITHUB_ENV" | |
- id: assign_label | |
if: env.repo_permission != 'admin' | |
run: gh pr edit ${{ github.event.number }} --add-label "$LABEL" |