-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
79 Associate GitHub actions to PR tags (#80)
- Loading branch information
1 parent
4ba98c2
commit 6db32b0
Showing
7 changed files
with
120 additions
and
18 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 |
---|---|---|
|
@@ -2,13 +2,25 @@ name: Java CI with Maven (Push) | |
|
||
on: | ||
push: | ||
branches: [ main ] | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
|
||
check-pr-labels: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
outputs: | ||
labels: ${{ steps.get-pr.outputs.pr_labels }} | ||
steps: | ||
- name: Get Pull Request information | ||
uses: 8BitJonny/[email protected] | ||
id: get-pr | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: [check-pr-labels] | ||
if: contains(needs.check-pr-labels.outputs.labels, 'release') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
|
@@ -17,8 +29,8 @@ jobs: | |
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
java-version: "11" | ||
distribution: "adopt" | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_CENTRAL_TOKEN | ||
|
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,20 @@ | ||
name: Pull Request Approved | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
|
||
concurrency: pr-${{ github.event.pull_request.id }} | ||
|
||
jobs: | ||
check-labels: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.mergeable == true && github.event.review.state == 'approved' | ||
steps: | ||
- name: Warn about missing labels | ||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release') && !contains(github.event.pull_request.labels.*.name, 'documentation') }} | ||
uses: thollander/actions-comment-pull-request@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
message: "This pull request hasn't been labeled as `release` nor `documentation`. Please ensure this is intentional before merging." | ||
comment_tag: label-warn |
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Sync Docs (Merge) | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
check-pr-labels: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
outputs: | ||
labels: ${{ steps.get-pr.outputs.pr_labels }} | ||
steps: | ||
- name: Get Pull Request information | ||
uses: 8BitJonny/[email protected] | ||
id: get-pr | ||
|
||
update-wiki: | ||
runs-on: ubuntu-latest | ||
needs: [check-pr-labels] | ||
if: contains(needs.check-pr-labels.outputs.labels, 'documentation') | ||
steps: | ||
- name: Setup variables | ||
run: | | ||
echo "REPO_DEST=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}').wiki" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Checkout SCC Multiapi Converter Repository | ||
run: git clone https://github.com/sngular/scc-multiapi-converter.git scc-multiapi-converter | ||
- name: Checkout SCC Multiapi Converter Wiki Repository | ||
run: git clone https://github.com/sngular/scc-multiapi-converter.wiki.git wiki | ||
- name: Copy docs and consolidate links | ||
run: | | ||
cp -rf scc-multiapi-converter/docs/* wiki/ | ||
cd wiki | ||
grep -lr "(.*\.md)" *|xargs -r sed -i 's/\.md//g' | ||
echo ">" | ||
git diff-index --quiet HEAD & git status -s | ||
echo "<" | ||
git status | ||
echo ">" | ||
git diff-index --quiet HEAD & git status -s | ||
echo "<" | ||
echo "TO_BE_CANCELLED=$(if [[ $(git diff-index --quiet HEAD & git status -s) ]]; then echo "false"; else echo "true"; fi)" >> $GITHUB_ENV | ||
echo "$TO_BE_CANCELLED" | ||
- name: Setup git user | ||
if: ${{ env.TO_BE_CANCELLED == 'false' }} | ||
run: | | ||
git config --global user.name ${{ github.actor }} | ||
- name: Sync Wiki | ||
if: ${{ env.TO_BE_CANCELLED == 'false' }} | ||
run: | | ||
cd wiki | ||
git status | ||
git add . | ||
git commit -m "scc-multiapi-converter documentation | GitHub Actions $GITHUB_WORKFLOW $GITHUB_RUN_NUMBER" | ||
git remote add origin-wiki "https://${{secrets.GITBOT_TOKEN}}@github.com/sngular/scc-multiapi-converter.wiki.git" | ||
git push origin-wiki main |
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