-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/fb-dia-1018' into fb-dia-953/str…
…eam-results
- Loading branch information
Showing
37 changed files
with
976 additions
and
1,415 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ jobs: | |
echo "image_version=$version" >> $GITHUB_OUTPUT | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.2.0 | ||
uses: docker/setup-buildx-action@v3.3.0 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/[email protected] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: "Convert stale PR's to drafts" | ||
|
||
on: | ||
schedule: | ||
- cron: '0 */1 * * *' # At minute 0 past every hour. | ||
workflow_dispatch: | ||
|
||
env: | ||
DRAFT_PROTECT_LABEL: "draft-protect" | ||
|
||
jobs: | ||
convert_stale_prs: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 2 | ||
steps: | ||
- uses: hmarr/[email protected] | ||
|
||
- id: get_timestamp | ||
name: Get timestamp | ||
shell: bash | ||
run: echo "ts=$(date -d '10 hours ago' +"%Y-%m-%dT%H:%M:%S")" >> $GITHUB_OUTPUT | ||
|
||
- uses: octokit/[email protected] | ||
name: Get PR older than 10 hours | ||
id: get_stale_prs | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GIT_PAT }} | ||
with: | ||
query: | | ||
{ | ||
search(query: "repo:${{ github.repository }} is:pr is:open draft:false -label:${{ env.DRAFT_PROTECT_LABEL }} updated:<=${{ steps.get_timestamp.outputs.ts }}", type: ISSUE, first: 100) { | ||
issueCount | ||
edges { | ||
node { | ||
... on PullRequest { | ||
number | ||
url | ||
id | ||
updatedAt | ||
} | ||
} | ||
} | ||
} | ||
} | ||
- name: Stale PRs data | ||
run: "echo '${{ steps.get_stale_prs.outputs.data }}'" | ||
|
||
- name: Convert to draft | ||
id: mutation_step | ||
shell: bash | ||
env: | ||
GIT_PAT: ${{ secrets.GIT_PAT }} | ||
run: | | ||
set -eux | ||
echo '${{ steps.get_stale_prs.outputs.data }}' > /tmp/stale_pr.json | ||
_pr_list=$(jq -r '.search.edges | map(.node.url) | join("\\n")' < /tmp/stale_pr.json) | ||
if [ -n "$_pr_list" ]; then | ||
echo "pr_list=$_pr_list" >> $GITHUB_OUTPUT | ||
echo "exec=true" >> $GITHUB_OUTPUT | ||
echo "$GIT_PAT" | gh auth login --with-token | ||
for pr_id in $(jq -r '.search.edges[].node.id' < /tmp/stale_pr.json); do | ||
gh api graphql -F id="${pr_id}" -f query=' | ||
mutation($id: ID!) { | ||
convertPullRequestToDraft(input: { pullRequestId: $id }) { | ||
pullRequest { | ||
id | ||
number | ||
isDraft | ||
} | ||
} | ||
} | ||
' | ||
done | ||
fi | ||
- name: Post to a Slack channel | ||
id: slack | ||
if: ${{ steps.mutation_step.outputs.exec == 'true' }} | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: 'C02LMULF4NA' | ||
payload: '{ "type": "mrkdwn", "text": "${{ env.SLACK_MESSAGE }}" }' | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_LSE_BOT_TOKEN }} | ||
SLACK_MESSAGE: >- | ||
*Drafted PR's*\n | ||
${{ steps.mutation_step.outputs.pr_list }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,4 +172,7 @@ pyrightconfig.json | |
# actions-hub | ||
.github/actions-hub | ||
|
||
.idea/ | ||
.idea/ | ||
|
||
# server config | ||
server/.env |
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
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
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
Oops, something went wrong.