Update GitHub action image #876
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: Issues Dashboard | |
on: | |
push: | |
paths: | |
- 'issues/**' | |
- '.github/workflows/issues.yml' | |
# schedule: | |
# - cron: '30 0,6,12 * * *' # Run daily at 6:00AM, 12:00Noon, 6:00PM IST (12:30AM, 6.30AM, 12.30PM UTC) | |
workflow_dispatch: | |
jobs: | |
dashboard: | |
name: Update Security Status | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Python packages | |
run: | | |
pip install requests | |
pip install networkx | |
pip install retry | |
pip install PyGithub | |
pip install semver | |
- name : Configure GitHub | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
BOT_USERNAME: ${{ secrets.BOT_USERNAME }} | |
BOT_EMAIL: ${{ secrets.BOT_EMAIL }} | |
run: | | |
git config --global user.name ${{ env.BOT_USERNAME }} | |
git config --global user.email ${{ env.BOT_EMAIL }} | |
git clone https://${{ env.BOT_USERNAME }}:${{ env.GITHUB_TOKEN }}@github.com/ldclakmal/ballerina-security.git | |
cd ballerina-security | |
git checkout master | |
- name: Update dashboard | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
run: | | |
cd ballerina-security | |
ls | |
python ./issues/scripts/update_dashboard.py | |
- name : Commit files | |
id: commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
BOT_USERNAME: ${{ secrets.BOT_USERNAME }} | |
run: | | |
cd ballerina-security | |
git update-index -q --refresh | |
if ! git diff-index --quiet HEAD --;then | |
echo ::set-output name=changes::true | |
git remote set-url origin https://${{ env.BOT_USERNAME }}:${{ env.GITHUB_TOKEN }}@github.com/ldclakmal/ballerina-security.git | |
git add . | |
git commit -m "[Automated] Update security status dashboard" | |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 | |
bin/hub push origin master | |
else | |
echo "No changes to commit" | |
fi |