Skip to content

Instantly share code, notes, and snippets.

@ybiquitous
Last active April 2, 2021 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ybiquitous/1a357f20e27249d9d24ad4321cb98579 to your computer and use it in GitHub Desktop.
Save ybiquitous/1a357f20e27249d9d24ad4321cb98579 to your computer and use it in GitHub Desktop.
Update outdated dependencies issue automatically via GitHub Actions
name: Outdated dependencies
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
jobs:
npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo npm install -g npm@latest
- run: npm ci
- name: Output outdated info
run: |
cat <<EOF > npm_outdated.txt
<details open>
<summary><code>npm outdated --long</code></summary>
<pre><code>$(npm outdated --long)
</code></pre>
</details>
Note: This issue should not be closed and aims to share outdated packages.
Updated: _$(date)_ (by **${GITHUB_ACTOR}**)
EOF
- run: gh issue edit "${ISSUE_ID}" --body-file npm_outdated.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_ID: ***
gem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
- name: Output outdated info
run: |
set +o pipefail
output=$(bundle outdated | grep -v -E '^(Fetching|Resolving)' | grep -v -E '^$')
cat <<EOF > bundle_outdated.txt
<details open>
<summary><code>bundle outdated</code></summary>
<pre><code>${output}
</code></pre>
</details>
Note: This issue should not be closed and aims to share outdated packages.
Updated: _$(date)_ (by **${GITHUB_ACTOR}**)
EOF
- run: gh issue edit "${ISSUE_ID}" --body-file bundle_outdated.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_ID: ***
@ybiquitous
Copy link
Author

Use https://github.com/juliangruber/read-file-action to process a multi-line body.

@ybiquitous
Copy link
Author

gh 1.8.0 supports --body-file flag, so read-file-action is no longer needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment