-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflow to update supported plugins
- Loading branch information
1 parent
4412f54
commit 910b78a
Showing
1 changed file
with
61 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Update Supported Plugins | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, labeled] | ||
push: | ||
branches: | ||
- main # or your default branch name | ||
|
||
jobs: | ||
update-plugins: | ||
runs-on: ubuntu-latest | ||
if: | | ||
(github.event_name == 'pull_request' && | ||
!github.event.pull_request.draft && | ||
contains(github.event.pull_request.labels.*.name, 'needs-review')) || | ||
(github.event_name == 'push') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # Fetch all history for all branches and tags | ||
|
||
- name: Check for changes in plugins directory | ||
id: check_changes | ||
run: | | ||
if git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | grep "^lua/black-atom/highlights/plugins/"; then | ||
echo "::set-output name=changes_detected::true" | ||
else | ||
echo "::set-output name=changes_detected::false" | ||
fi | ||
- name: Update Supported Plugins | ||
if: steps.check_changes.outputs.changes_detected == 'true' | ||
run: | | ||
chmod +x ./update_supported_plugins.sh | ||
./update_supported_plugins.sh | ||
- name: Check for README changes | ||
id: readme_changes | ||
run: | | ||
if git diff --exit-code README.md; then | ||
echo "::set-output name=changes::false" | ||
else | ||
echo "::set-output name=changes::true" | ||
fi | ||
- name: Commit README changes | ||
if: steps.readme_changes.outputs.changes == 'true' | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add README.md | ||
git commit -m "docs: update supported plugins list [skip ci]" | ||
- name: Push changes | ||
if: steps.readme_changes.outputs.changes == 'true' | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.head_ref }} |