Migrate to ECS environment #11
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: add labels for some cases | |
on: pull_request | |
jobs: | |
reviewapps: | |
name: grant 'reviewapps' label if there are any changes in PR's source code. | |
runs-on: ubuntu-latest # windows-latest | macos-latest | |
if: ${{ ! startsWith(github.head_ref, 'renovate/') }} | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
architecture: 'x64' | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v42 | |
with: | |
use_fork_point: true | |
- name: List all changed files | |
id: check-paths-ignore | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
FLAG=$(cat << '_EOF_' | python | |
import os | |
import sys | |
import pathlib | |
paths_ignore = [ | |
'.github/**/*.yml', | |
'**.md', | |
] | |
all_changed_files = os.getenv("ALL_CHANGED_FILES").split() | |
for filename in all_changed_files: | |
if not any(list(map(lambda pattern: pathlib.PurePath(filename).match(pattern), paths_ignore))): | |
print("false") | |
sys.exit() | |
print("true") | |
_EOF_ | |
) | |
echo "FLAG=${FLAG}" >> "GITHUB_OUTPUT" | |
- name: Labeling 'reviewapps' to PR | |
uses: actions/github-script@v7 | |
id: set-result | |
if: ${{ steps.check-paths-ignore.outputs.FLAG == 'false' }} | |
with: | |
result-encoding: string | |
script: | | |
const targetLabel = 'reviewapps'; | |
issue = await github.rest.issues.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
}); | |
flag = false; | |
issue.data.labels.filter(label => { | |
if (label.name == targetLabel) { flag = true; }; | |
}); | |
if (!flag) { | |
github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: [targetLabel] | |
}); | |
} |