Skip to content

Commit

Permalink
chore: add workflows/debug-action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
adoyle-h committed May 27, 2024
1 parent c5252ca commit eb248e7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 15 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/debug-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Debug the github action

on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:


jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 30

- name: Setup upterm session
uses: lhotari/action-upterm@v1
with:
## limits ssh access and adds the ssh public key for the user which triggered the workflow
limit-access-to-actor: true
## limits ssh access and adds the ssh public keys of the listed GitHub users
limit-access-to-users: adoyle-h
39 changes: 24 additions & 15 deletions .github/workflows/weekly-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,43 @@ jobs:
run:
runs-on: ubuntu-latest
steps:
- id: date
run:
echo "DATE=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 30

- name: Scan
id: report
run: |
c=$(git rev-list --all --since '1 week ago' --reverse | head -n1 || true)
if [ -n ${c:-} ]; then
git --no-pager diff --no-color -U0 "$c" HEAD -- '*.md' ':!index.md' |
grep -v -E '^(index|new file mode|deleted file mode|\-\-\-) ' |
sed -E -e 's|^diff --git a/(.+) b/.+|```\n\n### \1\n|g' -e 's/^\+\+\+.+/```diff/' |
tail +2
{
echo 'What changed in last week:'
git --no-pager diff --no-color -U0 "$c" HEAD -- '*.md' ':!index.md' |
grep -v -E '^(index|new file mode|deleted file mode|\-\-\-) ' |
sed -E -e 's|^diff --git a/(.+) b/.+|```\n\n### \1\n|g' -e 's/^\+\+\+.+/```diff/' |
tail +2
(( $? > 0 )) && exit 30
printf '```\n\n%s\n' 'Details in https://tools.adoyle.me/'
} > ./new_report
fi
- name: Create a new GitHub Discussion
uses: abirismyname/create-discussion@v1.x
if: ${{ steps.rerport.stdout != '' }}
uses: abirismyname/create-discussion@main
id: create-discussion
if: ${{ steps.report.conclusion == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "ADoyle's Tools Weekly ($(date +'%Y-%m-%d'))"
body: |
What changed in last week:
${{steps.rerport.stdout}}
```
Details in https://tools.adoyle.me/
title: "ADoyle's Tools Weekly (${{ steps.date.outputs.DATE }})"
body-filepath: ./new_report

# https://github.com/marketplace/actions/create-github-discussion#obtaining-the-repository-id-and-category-id
repository-id: MDEwOlJlcG9zaXRvcnk3Nzc4NzYzOA==
Expand Down

0 comments on commit eb248e7

Please sign in to comment.