Skip to content

Commit

Permalink
🧐 update github action work flow
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunhThanhDe committed Nov 4, 2024
1 parent 275ac8d commit 68e57b0
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/update_leaderboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update Leaderboard

on:
issues:
types: [opened]
types: [opened, edited]

jobs:
update_leaderboard:
Expand All @@ -25,15 +25,28 @@ jobs:
const updateLeaderboard = require('./.github/updateLeaderboard.js');
const result = await updateLeaderboard({ github, context });
core.setOutput('success', result); // Setting the output for later steps
core.setOutput('issueBody', context.payload.issue.body); // Get the issue body
- name: Create Pull Request
if: steps.update_leaderboard.outputs.success == 'true'
id: create_pr
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GH_TOKEN }}
branch: update-leaderboard
commit-message: ':sparkles: Update leaderboard'
title: 'Update Leaderboard'
body: |
This PR updates the leaderboard based on the latest game results.
body: ${{ steps.update_leaderboard.outputs.issueBody }} # Use the issue body as PR body
base: main

- name: Close Issue
if: steps.create_pr.outputs.pull_request_url != ''
uses: actions/github-script@v7
with:
script: |
const issue_number = context.payload.issue.number;
await github.issues.update({
...context.repo,
issue_number,
state: 'closed'
});

0 comments on commit 68e57b0

Please sign in to comment.