Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test pr: Removing the PR build from the site after a PR merge #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/merge_pr.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions .github/workflows/upload_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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"
Expand All @@ -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/."
Expand All @@ -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
Expand Down
39 changes: 21 additions & 18 deletions plugins/basemap-stamen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="http://stamen.com/">Stamen Design</a>, ',
'under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ',
'Data by <a href="http://openstreetmap.org/">OpenStreetMap</a>, ',
'under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.'
].join('')
'under <a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.',
].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);
Expand All @@ -52,13 +55,13 @@ function setup () {
minZoom: 1,
maxZoom: 21,
maxNativeZoom: 18,
type: 'jpg',
type: "jpg",
attribution: [
'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, ',
'under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ',
'Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, ',
'under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.'
].join('')
'under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.',
].join(""),
};
addLayer('Watercolor',options);
addLayer("Watercolor", options);
}