Skip to content

Commit

Permalink
fix: sync-data update to use latest version (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeveland27 authored Jun 17, 2020
1 parent 4f4a683 commit 16e7162
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 77 deletions.
53 changes: 32 additions & 21 deletions .github/actions/sync-data/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1975,17 +1975,29 @@ const ORG_REPOS = [
// }
];

// These entries should match the `fullName` in the corresponding project's json file
const EXCLUDED_PROJECTS = [
'adopt-open-jdk',
'open-telemetry/opentelemetry-go',
'open-telemetry/opentelemetry-java',
'open-telemetry',
'w3c-distributed-tracing-wg',
'newrelic/developer-toolkit',
'newrelic/extends_newrelic_rpm',
'newrelic/open-source-office',
'newrelic/open-source-tools',
'newrelic/sidecar'
'newrelic/sidecar',
'open-telemetry',
'open-telemetry-opentelemetry-auto-instr-java',
'open-telemetry-opentelemetry-collector',
'open-telemetry-opentelemetry-cpp',
'open-telemetry-opentelemetry-dotnet',
'open-telemetry-opentelemetry-erlang',
'open-telemetry/opentelemetry-go',
'open-telemetry/opentelemetry-java',
'open-telemetry-opentelemetry-ruby',
'open-telemetry/opentelemetry-specification',
'w3c-correlation-context',
'w3c-distributed-tracing-wg',
'w3c-trace-context',
'w3c-trace-context-binary',
'w3c-trace-response'
];

// TO DO - Ascertain Github's GraphQL query limits
Expand Down Expand Up @@ -23091,7 +23103,8 @@ function formatStats(project, stats) {
}

function writeProjectStatsToGatsby(project, projectStats) {
const workingDir = process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const workingDir =
process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const statsDir = core.getInput('stats-dir') || DEFAULT_DIR;
const outputDir = path.resolve(workingDir, statsDir);

Expand Down Expand Up @@ -26449,7 +26462,7 @@ const reposForOrgQuery = ({
tags: refs(refPrefix: "refs/tags/") {
totalCount
}
latestTag: refs(refPrefix: "refs/tags/", last: 1) {
latestTag: refs(refPrefix: "refs/tags/", last: 1, , orderBy: {field: TAG_COMMIT_DATE, direction: ASC}) {
nodes {
id
name
Expand Down Expand Up @@ -29922,7 +29935,8 @@ async function getProjectFullName(file, outputDir) {
* explicitly not generating stats for.
*/
async function getProjectsAndExclusions() {
const workingDir = process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const workingDir =
process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const projectsDir = core.getInput('stats-dir') || 'src/data/projects';
const outputDir = path.resolve(workingDir, projectsDir);

Expand Down Expand Up @@ -32095,7 +32109,6 @@ module.exports = isWeekend
/* 767 */
/***/ (function(module, __unusedexports, __webpack_require__) {

// const github = require("@actions/github")
const core = __webpack_require__(470);
const { Octokit } = __webpack_require__(889);
const parseLinkHeader = __webpack_require__(386);
Expand All @@ -32108,8 +32121,8 @@ const REPOS_PER_PAGE = 100;
const octokit = new Octokit({
auth: GH_TOKEN,
log: {
debug: () => { },
info: () => { },
debug: () => {},
info: () => {},
// eslint-disable-next-line no-console
warn: console.warn,
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -32233,15 +32246,15 @@ const octokit = new Octokit({
* start_page - Beginning page
* exclude_archived - Whether or not to filter out archived repositories (repos.listForOrg does not offer a way to exclude these from the response)
*/
const organizationRepositoryIterator = function ({
const organizationRepositoryIterator = function({
pages = 1,
org = DEFAULT_ORG,
type = 'public',
per_page = REPOS_PER_PAGE,
start_page = 1
// excludeArchived = true
}) {
return function () {
return function() {
const MAX_PAGES_ALLOWED = 100;

let isFirstPage = true;
Expand All @@ -32253,15 +32266,15 @@ const organizationRepositoryIterator = function ({
// How best do we initialize this for the first page?
let pagesToGet = pages === 0 ? MAX_PAGES_ALLOWED : pages;

const hasMore = function () {
const hasMore = function() {
return pagesToGet > 0;
};

const getCurrentPage = function () {
const getCurrentPage = function() {
return currentPage;
};

const firstPage = async function () {
const firstPage = async function() {
const firstPage = await fetchOrganizationRepositoryPage({
org,
type,
Expand All @@ -32286,7 +32299,7 @@ const organizationRepositoryIterator = function ({
return firstPage;
};

const next = function () {
const next = function() {
let nextPage = false;

if (hasMore()) {
Expand Down Expand Up @@ -32324,7 +32337,7 @@ const organizationRepositoryIterator = function ({
};
};

const fetchOrganizationRepositoryPage = async function ({
const fetchOrganizationRepositoryPage = async function({
org,
type,
per_page,
Expand All @@ -32351,7 +32364,7 @@ const fetchOrganizationRepositoryPage = async function ({
}
};

const fetchRepo = async function ({ options }) {
const fetchRepo = async function({ options }) {
const { org: owner, repo } = options;

return octokit.repos.get({
Expand Down Expand Up @@ -32752,12 +32765,10 @@ const stringToColor = str => {

let hash = 0;
for (let i = 0; i < str.length; i += 1) {
// eslint-disable-next-line no-bitwise
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
let colour = '#';
for (let i = 0; i < 3; i += 1) {
// eslint-disable-next-line no-bitwise
const value = (hash >> (i * 8)) & 0xff;
colour += `00${value.toString(16)}`.substr(-2);
}
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/sync-data/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/actions/sync-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
"@zeit/ncc": "^0.20.5",
"eslint": "^6.8.0",
"jest": "^25.2.4",
"prettier": "^2.0.5"
"prettier": "^1.19.1"
}
}
20 changes: 10 additions & 10 deletions .github/actions/sync-data/src/data-generator/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const REPOS_PER_PAGE = 100;
const octokit = new Octokit({
auth: GH_TOKEN,
log: {
debug: () => { },
info: () => { },
debug: () => {},
info: () => {},
// eslint-disable-next-line no-console
warn: console.warn,
// eslint-disable-next-line no-console
Expand Down Expand Up @@ -135,15 +135,15 @@ const octokit = new Octokit({
* start_page - Beginning page
* exclude_archived - Whether or not to filter out archived repositories (repos.listForOrg does not offer a way to exclude these from the response)
*/
const organizationRepositoryIterator = function ({
const organizationRepositoryIterator = function({
pages = 1,
org = DEFAULT_ORG,
type = 'public',
per_page = REPOS_PER_PAGE,
start_page = 1
// excludeArchived = true
}) {
return function () {
return function() {
const MAX_PAGES_ALLOWED = 100;

let isFirstPage = true;
Expand All @@ -155,15 +155,15 @@ const organizationRepositoryIterator = function ({
// How best do we initialize this for the first page?
let pagesToGet = pages === 0 ? MAX_PAGES_ALLOWED : pages;

const hasMore = function () {
const hasMore = function() {
return pagesToGet > 0;
};

const getCurrentPage = function () {
const getCurrentPage = function() {
return currentPage;
};

const firstPage = async function () {
const firstPage = async function() {
const firstPage = await fetchOrganizationRepositoryPage({
org,
type,
Expand All @@ -188,7 +188,7 @@ const organizationRepositoryIterator = function ({
return firstPage;
};

const next = function () {
const next = function() {
let nextPage = false;

if (hasMore()) {
Expand Down Expand Up @@ -226,7 +226,7 @@ const organizationRepositoryIterator = function ({
};
};

const fetchOrganizationRepositoryPage = async function ({
const fetchOrganizationRepositoryPage = async function({
org,
type,
per_page,
Expand All @@ -253,7 +253,7 @@ const fetchOrganizationRepositoryPage = async function ({
}
};

const fetchRepo = async function ({ options }) {
const fetchRepo = async function({ options }) {
const { org: owner, repo } = options;

return octokit.repos.get({
Expand Down
24 changes: 12 additions & 12 deletions .github/actions/sync-data/src/shared/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ const EXCLUDED_PROJECTS = [
'newrelic/open-source-tools',
'newrelic/sidecar',
'open-telemetry',
"open-telemetry-opentelemetry-auto-instr-java",
"open-telemetry-opentelemetry-collector",
"open-telemetry-opentelemetry-cpp",
"open-telemetry-opentelemetry-dotnet",
"open-telemetry-opentelemetry-erlang",
'open-telemetry-opentelemetry-auto-instr-java',
'open-telemetry-opentelemetry-collector',
'open-telemetry-opentelemetry-cpp',
'open-telemetry-opentelemetry-dotnet',
'open-telemetry-opentelemetry-erlang',
'open-telemetry/opentelemetry-go',
'open-telemetry/opentelemetry-java',
"open-telemetry-opentelemetry-ruby",
"open-telemetry/opentelemetry-specification",
"w3c-correlation-context",
"w3c-distributed-tracing-wg",
"w3c-trace-context",
"w3c-trace-context-binary",
"w3c-trace-response"
'open-telemetry-opentelemetry-ruby',
'open-telemetry/opentelemetry-specification',
'w3c-correlation-context',
'w3c-distributed-tracing-wg',
'w3c-trace-context',
'w3c-trace-context-binary',
'w3c-trace-response'
];

// TO DO - Ascertain Github's GraphQL query limits
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/sync-data/src/stats-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ async function getProjectFullName(file, outputDir) {
* explicitly not generating stats for.
*/
async function getProjectsAndExclusions() {
const workingDir = process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const workingDir =
process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const projectsDir = core.getInput('stats-dir') || 'src/data/projects';
const outputDir = path.resolve(workingDir, projectsDir);

Expand Down
2 changes: 0 additions & 2 deletions .github/actions/sync-data/src/stats-generator/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ const stringToColor = str => {

let hash = 0;
for (let i = 0; i < str.length; i += 1) {
// eslint-disable-next-line no-bitwise
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
let colour = '#';
for (let i = 0; i < 3; i += 1) {
// eslint-disable-next-line no-bitwise
const value = (hash >> (i * 8)) & 0xff;
colour += `00${value.toString(16)}`.substr(-2);
}
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/sync-data/src/stats-generator/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ function formatStats(project, stats) {
}

function writeProjectStatsToGatsby(project, projectStats) {
const workingDir = process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const workingDir =
process.env.GITHUB_WORKSPACE || path.join(__dirname, '../../../../../');
const statsDir = core.getInput('stats-dir') || DEFAULT_DIR;
const outputDir = path.resolve(workingDir, statsDir);

Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/project-stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v2.3.0
with:
ref: develop
fetch-depth: 0
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
needs: job-sync-project-data
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v2.3.0

- name: Setup Node.js
uses: actions/setup-node@v1
Expand Down Expand Up @@ -95,27 +95,27 @@ jobs:
#############################################################################################################
## Note: Removing the webhook-driven deployment (for now) in favor of utilizing auto-builds on Amplify
#############################################################################################################
# job-deploy-staging:
# runs-on: ubuntu-latest
# needs: [job-sync-project-data, job-checkout-and-build]
# env:
# STAGING_WEBHOOK: ${{ secrets.AMPLIFY_STAGING_WEBHOOK }}
# steps:
# - name: Call Amplify Staging Deploy
# run: |
# echo "Calling Amplify staging webhook"
# curl --silent --show-error --output /dev/null -X POST $STAGING_WEBHOOK -H "Content-Type:application/json"
# echo "**OUTPUT SUPPRESSED**"
# echo "Webhook call complete"
# job-deploy-prod:
# runs-on: ubuntu-latest
# needs: [job-sync-project-data, job-checkout-and-build]
# env:
# PROD_WEBHOOK: ${{ secrets.AMPLIFY_PROD_WEBHOOK }}
# steps:
# - name: Call Amplify Prod Deploy
# run: |
# echo "Calling Amplify prod webhook"
# curl --silent --show-error --output /dev/null -X POST $PROD_WEBHOOK -H "Content-Type:application/json"
# echo "**OUTPUT SUPPRESSED**"
# echo "Webhook call complete"
# job-deploy-staging:
# runs-on: ubuntu-latest
# needs: [job-sync-project-data, job-checkout-and-build]
# env:
# STAGING_WEBHOOK: ${{ secrets.AMPLIFY_STAGING_WEBHOOK }}
# steps:
# - name: Call Amplify Staging Deploy
# run: |
# echo "Calling Amplify staging webhook"
# curl --silent --show-error --output /dev/null -X POST $STAGING_WEBHOOK -H "Content-Type:application/json"
# echo "**OUTPUT SUPPRESSED**"
# echo "Webhook call complete"
# job-deploy-prod:
# runs-on: ubuntu-latest
# needs: [job-sync-project-data, job-checkout-and-build]
# env:
# PROD_WEBHOOK: ${{ secrets.AMPLIFY_PROD_WEBHOOK }}
# steps:
# - name: Call Amplify Prod Deploy
# run: |
# echo "Calling Amplify prod webhook"
# curl --silent --show-error --output /dev/null -X POST $PROD_WEBHOOK -H "Content-Type:application/json"
# echo "**OUTPUT SUPPRESSED**"
# echo "Webhook call complete"

0 comments on commit 16e7162

Please sign in to comment.