[Question] #99
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: update_cache | |
env: | |
PYTHON_VERSION: "3.8" # set this to the Python version to use | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
on: | |
issues: | |
types: | |
- labeled | |
jobs: | |
update-conf-list: | |
if: github.event.label.name == 'require to update cache' | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python version | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Create and start virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Set up dependency caching for faster installs | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Update the cache file from the issue | |
run: | | |
python update_cache.py --issue ${{ toJson(github.event.issue.body) }} | |
python maintain.py | |
- name: Commit files | |
id: commit | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "github-actions" | |
git add --all | |
if [-z "$(git status --porcelain)"]; then | |
echo "::set-output name=push::false" | |
else | |
git commit -m "chore: update cache" -a | |
echo "::set-output name=push::true" | |
fi | |
shell: bash | |
- name: Push changes | |
if: steps.commit.outputs.push == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |