Conference Workflow #1
This file contains hidden or 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: Conference Workflow | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # This will run the workflow every Sunday at midnight | |
push: | |
branches: | |
- "**/issue**" | |
issues: | |
types: [opened, closed, edited, deleted] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
conference-job: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.GITHUB_TOKEN }} | |
- name: Setup Python environment | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: pip install PyGithub PyYAML pre-commit | |
- name: Run script | |
env: | |
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | |
run: | | |
python _conferences | |
pre-commit run --all-files --show-diff-on-failure | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ env.GITHUB_TOKEN }} | |
commit-message: Update conferences | |
committer: GitHub Action <[email protected]> | |
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
branch: update-conferences | |
delete-branch: true | |
title: "[CONFERENCE] Update Conferences" | |
labels: | | |
report | |
automated pr | |
add_comment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add comment to the issue | |
uses: actions/github-script@v6 | |
if: ${{ github.event.issue.user.type != 'User' }} #adds comment only if the issue is created by a bot | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const issueNumber = context.payload.issue.number; | |
const comment = "Automated issue, no action is required." | |
github.issues.createComment({ | |
...context.repo, | |
issue_number: issueNumber, | |
body: comment | |
}); |