1
0
Fork 0
mirror of https://github.com/ipfs/awesome-ipfs.git synced 2024-11-20 11:28:35 -05:00

feat: ensure broken_link_cron.yml opens PR (#434)

* test: add invalid entry to data/apps.yaml

* debug: git-auto-commit-action should run since there are modified files

* fix: output variable name

* fix: workflow permissions

* debugging

* debugging more

* debugging more

* debugging even more

* fix: remove pull action for add-and-commit

* fix: use ipfs-gui-bot token permissions

* chore: Remove broken links (#435)

Co-authored-by: ipfs-gui-bot <108953096+ipfs-gui-bot@users.noreply.github.com>

* chore: cleanup

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: ipfs-gui-bot <108953096+ipfs-gui-bot@users.noreply.github.com>
This commit is contained in:
Russell Dempsey 2022-09-16 12:39:16 -07:00 committed by GitHub
parent dd28c19ba7
commit 2f2d2236a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,15 +5,20 @@ on:
schedule:
- cron: '0 0 * * *'
permissions:
issues: write
pull-requests: write
jobs:
check-for-broken-links:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REMOVE_BROKEN_LINKS_GH_TOKEN }}
- uses: actions/setup-node@v3
with:
@ -32,7 +37,19 @@ jobs:
with:
ruby-version: 3.1.2
# Cache the files created by awesome_bot
- name: Cache awesome_bot files
uses: actions/cache@v3
id: awesome_bot_cache
with:
path: |
ab-results-README.md-filtered.json
ab-results-README.md-markdown-table.json
ab-results-README.md.json
key: ${{ runner.os }}-awesome_bot-${{ hashFiles('README.md') }}
- name: Install and run awesome_bot
if: steps.awesome_bot_cache.outputs.cache-hit != 'true'
run: |
gem install awesome_bot
awesome_bot --allow 429 --allow-redirect --allow-dupe --allow-ssl -w ipfs.io README.md || echo
@ -45,42 +62,23 @@ jobs:
git ls-files -m
changed_data_files_count=$(git ls-files -m data | wc -l | tr -d ' ')
echo "changed_data_files_count='$changed_data_files_count'"
echo "::set-output name=changed_files::$changed_data_files_count"
echo "::set-output name=changed_data_files_count::$changed_data_files_count"
- uses: stefanzweifel/git-auto-commit-action@49620cd3ed21ee620a48530e81dba0d139c9cb80
if: steps.remove-broken-links.outputs.changed_data_files_count > 0
- uses: EndBug/add-and-commit@d4d066316a2a85974a05efb42be78f897793c6d9 # v9.1.0 - https://github.com/EndBug/add-and-commit/commit/d4d066316a2a85974a05efb42be78f897793c6d9
if: steps.remove-broken-links.outputs.changed_data_files_count != 0
with:
# Optional. Commit message for the created commit.
# Defaults to "Apply automatic changes"
commit_message: "chore: Remove broken links"
# Optional. Local and remote branch name where commit is going to be pushed
# to. Defaults to the current branch.
# You might need to set `create_branch: true` if the branch does not exist.
branch: remove-broken-links-${{ github.run_id }}
commit_options: '--no-verify --signoff'
# Optional glob pattern of files which should be added to the commit
# Defaults to all (.)
# See the `pathspec`-documentation for git
# - https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203
# - https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
file_pattern: data/*
repository: .
add_options: '-A'
push_options: '--force'
skip_dirty_check: true
skip_fetch: true
skip_checkout: true
disable_globbing: true
create_branch: true
add: 'data'
new_branch: remove-broken-links
message: 'chore: Remove broken links'
push: 'origin remove-broken-links --set-upstream --force'
author_name: 'ipfs-gui-bot'
author_email: '108953096+ipfs-gui-bot@users.noreply.github.com'
- name: pull-request
if: steps.remove-broken-links.outputs.changed_data_files_count > 0
if: steps.remove-broken-links.outputs.changed_data_files_count != 0
uses: repo-sync/pull-request@65785d95a5a466e46a9d0708933a3bd51bbf9dde
with:
source_branch: "remove-broken-links-${{ github.run_id }}"
source_branch: "remove-broken-links"
destination_branch: "master"
pr_title: "chore: Remove broken links"
pr_body: "Automated PR created by .github/workflows/broken_link_cron.yml"