Remove Triage Label #96
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
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Remove Triage Label | |
on: | |
workflow_run: | |
workflows: [Pull Request Reviewed] | |
types: | |
- completed | |
jobs: | |
# This job runs with elevated permissions and the ability to modify pull requests. The steps taken here | |
# should be limited to updating labels and adding comments to PRs. This approach is taken from | |
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/. | |
remove-triage: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Env | |
run: printenv | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
- uses: actions/download-artifact@v4 | |
with: | |
github-token: ${{ github.token }} | |
run-id: ${{ github.event.workflow_run.id }} | |
name: pr-number.txt | |
- name: Remove label | |
uses: actions/github-script@v7 | |
continue-on-error: true | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
var fs = require('fs'); | |
var pr_number = Number(fs.readFileSync('./pr-number.txt')); | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: pr_number, | |
name: 'triage' | |
}); |