Add Github action to add documentation tag #2
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 documentation tag | |
on: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
check: | |
name: Check modified files | |
outputs: | |
run_job: ${{ steps.check_files.outputs.run_job }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: check modified files | |
id: check_files | |
run: | | |
echo "=============== list modified files ===============" | |
git diff --name-only HEAD^ HEAD | |
echo "========== check paths of modified files ==========" | |
git diff --name-only HEAD^ HEAD > files.txt | |
while IFS= read -r file | |
do | |
echo $file | |
if [[ $file != docs/* ]]; then | |
echo "This modified file is not under the 'docs' folder." | |
echo "::set-output name=run_job::false" | |
break | |
else | |
echo "::set-output name=run_job::true" | |
fi | |
done < files.txt | |
job_for_db: | |
tag_documentation: | |
name: tag documentation | |
needs: check | |
if: needs.check.outputs.run_job == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: add documentation tag | |
run: echo "Add tag" |