diff --git a/.github/workflows/merge_pr.yml b/.github/workflows/merge_pr.yml new file mode 100644 index 000000000..da95ceeda --- /dev/null +++ b/.github/workflows/merge_pr.yml @@ -0,0 +1,33 @@ +name: After PR merging + +on: + pull_request: + types: + - closed + +jobs: + if_merged: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v3 + if: ${{ secrets.WEBSITE_REPO != '' }} + with: + repository: ${{ secrets.WEBSITE_REPO }} + ref: 'master' + token: ${{ secrets.API_TOKEN_GITHUB }} + + - name: Setup git config + if: ${{ secrets.WEBSITE_REPO != '' }} + run: | + git config user.name "userz" + git config user.email "<>" + + - name: Delete old build artifacts + if: ${{ secrets.WEBSITE_REPO != '' }} + run: | + git rm -r static/build/artifact/PR${{ github.event.number }}/ + git commit -m "🤖 PR #${{ github.event.number }} merged, deleting old build artifacts" + + - run: git push origin master diff --git a/.github/workflows/upload_pr.yml b/.github/workflows/upload_pr.yml index 4d70894a8..aac1cdba8 100644 --- a/.github/workflows/upload_pr.yml +++ b/.github/workflows/upload_pr.yml @@ -17,6 +17,7 @@ jobs: steps: - name: 'Download artifact' uses: actions/github-script@v6 + if: ${{ secrets.WEBSITE_REPO != '' }} with: script: | let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -37,9 +38,11 @@ jobs: fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/build.zip`, Buffer.from(download.data)); - name: 'Unzip artifact' + if: ${{ secrets.WEBSITE_REPO != '' }} run: unzip build.zip - name: Set env + if: ${{ secrets.WEBSITE_REPO != '' }} run: | echo "PR_NUMBER=$(cat ./.metadata/number)" >> "$GITHUB_ENV" echo "COMMIT_HASH=$(cat ./.metadata/commit)" >> "$GITHUB_ENV" @@ -48,10 +51,10 @@ jobs: echo "BUILDSTAMP=$(cat ./.metadata/buildstamp)" >> "$GITHUB_ENV" - name: Push build artifacts to website + if: ${{ secrets.WEBSITE_REPO != '' }} env: WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }} API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} - if: ${{ env.WEBSITE_REPO != '' }} uses: dmnemec/copy_file_to_another_repo_action@main with: source_file: "./build/." @@ -63,9 +66,9 @@ jobs: commit_message: '🤖 New IITC test build from https://github.com/${{ github.repository }}/commit/${{ github.sha }}' - name: Comment with build url - if: ${{ env.WEBSITE_REPO != '' }} env: WEBSITE_REPO: ${{ secrets.WEBSITE_REPO }} + if: ${{ secrets.WEBSITE_REPO != '' }} uses: marocchino/sticky-pull-request-comment@v2 with: header: pr_release diff --git a/plugins/basemap-stamen.js b/plugins/basemap-stamen.js index 7873b049f..06810e7a3 100644 --- a/plugins/basemap-stamen.js +++ b/plugins/basemap-stamen.js @@ -4,39 +4,42 @@ // @version 0.2.1 // @description Add the 'Toner' and 'Watercolor' map layers from maps.stamen.com. - // see API here http://maps.stamen.com/ // https://stamen-maps.a.ssl.fastly.net/js/tile.stamen.js (overcomplicated) -function setup () { - var baseUrl = 'https://stamen-tiles-{s}.a.ssl.fastly.net/{layer}/{z}/{x}/{y}.{type}'; +function setup() { + var baseUrl = + "https://stamen-tiles-{s}.a.ssl.fastly.net/{layer}/{z}/{x}/{y}.{type}"; var L_StamenTileLayer = L.TileLayer.extend({ options: { - subdomains: 'abcd', - type: 'png', + subdomains: "abcd", + type: "png", minZoom: 0, maxZoom: 21, attribution: [ 'Map tiles by Stamen Design, ', 'under CC BY 3.0. ', 'Data by OpenStreetMap, ', - 'under CC BY SA.' - ].join('') + 'under CC BY SA.', + ].join(""), }, initialize: function (name, options) { - options.layer = name.replace(' ','-').toLowerCase(); + options.layer = name.replace(" ", "-").toLowerCase(); L.TileLayer.prototype.initialize.call(this, baseUrl, options); - } + }, }); - function addLayer (name,options) { - layerChooser.addBaseLayer(new L_StamenTileLayer(name,options),'Stamen ' + name); + function addLayer(name, options) { + layerChooser.addBaseLayer( + new L_StamenTileLayer(name, options), + "Stamen " + name + ); } var options = { minZoom: 0, maxNativeZoom: 20 }; - addLayer('Toner',options); - addLayer('Toner Background',options); - addLayer('Toner Lite',options); + addLayer("Toner", options); + addLayer("Toner Background", options); + addLayer("Toner Lite", options); // transparent layers. could be useful over satellite imagery or similar // addLayer('Toner Hybrid',options); // addLayer('Toner Labels',options); @@ -52,13 +55,13 @@ function setup () { minZoom: 1, maxZoom: 21, maxNativeZoom: 18, - type: 'jpg', + type: "jpg", attribution: [ 'Map tiles by Stamen Design, ', 'under CC BY 3.0. ', 'Data by OpenStreetMap, ', - 'under ODbL.' - ].join('') + 'under ODbL.', + ].join(""), }; - addLayer('Watercolor',options); + addLayer("Watercolor", options); }