Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflow to commit to branch and post as PR #12562

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 44 additions & 8 deletions .github/workflows/import-community-events.yml
Original file line number Diff line number Diff line change
@@ -9,15 +9,51 @@ jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
- name: Check out code
uses: actions/checkout@master

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn install
- run: yarn events-import

- name: Install dependencies
run: yarn install

- name: Set up git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"

- name: Generate timestamp and readable date
id: date
run: |
echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
echo "READABLE_DATE=$(date +'%B %-d')" >> $GITHUB_ENV

- name: Fetch latest dev and create new branch
run: |
git fetch origin dev
git checkout -b "automated-update-${{ env.TIMESTAMP }}" origin/dev

- name: Run script
run: yarn events-import
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Update community events"

- name: Commit and push
run: |
git add -A
git commit -m "Update community events"
git push origin "automated-update-${{ env.TIMESTAMP }}"

- name: Create PR body
run: |
echo "This PR was automatically created to update community events from external community spreadsheet." > pr_body.txt
echo "This workflows runs every Sunday at 00:00 (UTC)." >> pr_body.txt
echo "Source: https://docs.google.com/spreadsheets/d/1NEu_FCc1hnGAuRgPmbXXpf0h2lCrCOlMKbbFEqgkVDQ" >> pr_body.txt

- name: Create Pull Request
run: |
gh auth login --with-token ${{ secrets.GITHUB_TOKEN }}
gh pr create --base dev --head "automated-update-${{ env.TIMESTAMP }}" --title "Update community events from external spreadsheet - ${{ env.READABLE_DATE }}" --body-file pr_body.txt